'Write a string to a worksheet cell.
Args:
row:    The cell row (zero indexed).
col:    The cell column (zero indexed).
string: Cell data. Str.
format: An optional cell Format object.
Returns:
0:  Success.
-1: Row or column is out of worksheet bounds.
-2: String truncated to 32k characters.'

@convert_cell_args
def write_string(self, row, col, string, cell_format=None):

    str_error = 0
    if self._check_dimensions(row, col):
        return (-1)
    if (len(string) > self.xls_strmax):
        string = string[:self.xls_strmax]
        str_error = (-2)
    if (not self.constant_memory):
        string_index = self.str_table._get_shared_string_index(string)
    else:
        string_index = string
    if (self.constant_memory and (row > self.previous_row)):
        self._write_single_row(row)
    self.table[row][col] = cell_string_tuple(string_index, cell_format)
    return str_error
