libxlsxwriter
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions | Macros
utility.h File Reference

Functions

char * lxw_strerror (lxw_error error_num)
 Converts a libxlsxwriter error number to a string. More...
 

Function Documentation

char* lxw_strerror ( lxw_error  error_num)

The lxw_strerror function converts a libxlsxwriter error number defined by lxw_error to a pointer to a string description of the error. Similar to the standard library strerror(3) function.

For example:

lxw_error error = workbook_close(workbook);
if (error)
printf("Error in workbook_close().\n"
"Error %d = %s\n", error, lxw_strerror(error));

This would produce output like the following if the target file wasn't writable:

Error in workbook_close().
Error 2 = Error creating output xlsx file. Usually a permissions error.
Parameters
error_numThe error number returned by a libxlsxwriter function.
Returns
A pointer to a statically allocated string. Do not free.
Examples:
anatomy.c.

Macro Definition Documentation

#define CELL (   cell)    lxw_name_to_row(cell), lxw_name_to_col(cell)

Convert an Excel A1 cell string into a (row, col) pair.

This is a little syntactic shortcut to help with worksheet layout:

worksheet_write_string(worksheet, CELL("A1"), "Foo", NULL);
//Same as:
worksheet_write_string(worksheet, 0, 0, "Foo", NULL);
Note

This macro shouldn't be used in performance critical situations since it expands to two function calls.

Examples:
chart.c, chart_area.c, chart_bar.c, chart_clustered.c, chart_column.c, chart_data_table.c, chart_data_tools.c, chart_doughnut.c, chart_fonts.c, chart_line.c, chart_pattern.c, chart_pie.c, chart_radar.c, chart_scatter.c, and images.c.
#define COLS (   cols)    lxw_name_to_col(cols), lxw_name_to_col_2(cols)

Convert an Excel A:B column range into a (col1, col2) pair.

This is a little syntactic shortcut to help with worksheet layout:

worksheet_set_column(worksheet, COLS("B:D"), 20, NULL, NULL);
// Same as:
worksheet_set_column(worksheet, 1, 3, 20, NULL, NULL);
Examples:
hide_row_col.c, and images.c.
#define RANGE (   range)
Value:
lxw_name_to_row(range), lxw_name_to_col(range), \
lxw_name_to_row_2(range), lxw_name_to_col_2(range)

Convert an Excel A1:B2 range into a (first_row, first_col, last_row, last_col) sequence.

This is a little syntactic shortcut to help with worksheet layout.

worksheet_print_area(worksheet, 0, 0, 41, 10); // A1:K42.
// Same as:
worksheet_print_area(worksheet, RANGE("A1:K42"));
Examples:
array_formula.c.

Macros

#define CELL(cell)   lxw_name_to_row(cell), lxw_name_to_col(cell)
 Convert an Excel A1 cell string into a (row, col) pair. More...
 
#define COLS(cols)   lxw_name_to_col(cols), lxw_name_to_col_2(cols)
 Convert an Excel A:B column range into a (col1, col2) pair. More...
 
#define RANGE(range)
 Convert an Excel A1:B2 range into a (first_row, first_col, last_row, last_col) sequence. More...