/* * Convert zero indexed row and column to an Excel style A1 cell reference. */ void lxw_rowcol_to_cell(char *cell_name, int row, int col) { uint8_t pos; /* Add the column to the cell. */ lxw_col_to_name(cell_name, col, 0); /* Get the end of the cell. */ pos = strlen(cell_name); /* Add the row to the cell. */ sprintf(&cell_name[pos], "%d", ++row); }
/* * Convert zero indexed row and column to an Excel style A1 cell reference. */ void lxw_rowcol_to_cell(char *cell_name, lxw_row_t row, lxw_col_t col) { size_t pos; /* Add the column to the cell. */ lxw_col_to_name(cell_name, col, 0); /* Get the end of the cell. */ pos = strlen(cell_name); /* Add the row to the cell. */ lxw_snprintf(&cell_name[pos], LXW_MAX_ROW_NAME_LENGTH, "%d", ++row); }
/* * Convert zero indexed row and column to an Excel style $A$1 cell with * an absolute reference. */ void lxw_rowcol_to_cell_abs(char *cell_name, int row, int col, uint8_t abs_row, uint8_t abs_col) { uint8_t pos; /* Add the column to the cell. */ lxw_col_to_name(cell_name, col, abs_col); /* Get the end of the cell. */ pos = strlen(cell_name); if (abs_row) cell_name[pos++] = '$'; /* Add the row to the cell. */ sprintf(&cell_name[pos], "%d", ++row); }