xlsxwriter.worksheet

@page worksheet_page The Worksheet object

The Worksheet object represents an Excel worksheet. It handles operations such as writing data to cells or formatting worksheet layout.

See @ref worksheet.h for full details of the functionality.

@file worksheet.h

@brief Functions related to adding data and formatting to a worksheet.

The Worksheet object represents an Excel worksheet. It handles operations such as writing data to cells or formatting worksheet layout.

A Worksheet object isn't created directly. Instead a worksheet is created by calling the workbook_add_worksheet() function from a Workbook object:

@code #include "xlsxwriter.h"

int main() {

lxw_workbook *workbook = workbook_new("filename.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

worksheet_write_string(worksheet, 0, 0, "Hello Excel", NULL);

return workbook_close(workbook); } @endcode

Members

Enums

cell_types
enum cell_types
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_gridlines
enum lxw_gridlines

Gridline options using in worksheet_gridlines().

pane_types
enum pane_types
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Functions

lxw_worksheet_assemble_xml_file
void lxw_worksheet_assemble_xml_file(lxw_worksheet* worksheet)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_find_cell
lxw_cell* lxw_worksheet_find_cell(lxw_row* row, lxw_col_t col_num)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_find_row
lxw_row* lxw_worksheet_find_row(lxw_worksheet* worksheet, lxw_row_t row_num)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_free
void lxw_worksheet_free(lxw_worksheet* worksheet)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_new
lxw_worksheet* lxw_worksheet_new(lxw_worksheet_init_data* init_data)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_prepare_chart
void lxw_worksheet_prepare_chart(lxw_worksheet* worksheet, uint16_t chart_ref_id, uint16_t drawing_id, lxw_image_options* image_data)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_prepare_image
void lxw_worksheet_prepare_image(lxw_worksheet* worksheet, uint16_t image_ref_id, uint16_t drawing_id, lxw_image_options* image_data)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet_write_single_row
void lxw_worksheet_write_single_row(lxw_worksheet* worksheet)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
worksheet_activate
void worksheet_activate(lxw_worksheet* worksheet)

@brief Make a worksheet the active, i.e., visible worksheet.

worksheet_autofilter
lxw_error worksheet_autofilter(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t last_row, lxw_col_t last_col)

@brief Set the autofilter area in the worksheet.

worksheet_center_horizontally
void worksheet_center_horizontally(lxw_worksheet* worksheet)

@brief Center the printed page horizontally.

worksheet_center_vertically
void worksheet_center_vertically(lxw_worksheet* worksheet)

@brief Center the printed page vertically.

worksheet_fit_to_pages
void worksheet_fit_to_pages(lxw_worksheet* worksheet, uint16_t width, uint16_t height)

@brief Fit the printed area to a specific number of pages both vertically and horizontally.

worksheet_freeze_panes
void worksheet_freeze_panes(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col)

@brief Split and freeze a worksheet into panes.

worksheet_freeze_panes_opt
void worksheet_freeze_panes_opt(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t top_row, lxw_col_t left_col, uint8_t type)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
worksheet_gridlines
void worksheet_gridlines(lxw_worksheet* worksheet, uint8_t option)

@brief Set the option to display or hide gridlines on the screen and the printed page.

worksheet_hide
void worksheet_hide(lxw_worksheet* worksheet)

@brief Hide the current worksheet.

worksheet_hide_zero
void worksheet_hide_zero(lxw_worksheet* worksheet)

@brief Hide zero values in worksheet cells.

worksheet_insert_chart
lxw_error worksheet_insert_chart(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, lxw_chart* chart)

@brief Insert a chart object into a worksheet.

worksheet_insert_chart_opt
lxw_error worksheet_insert_chart_opt(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, lxw_chart* chart, lxw_image_options* user_options)

@brief Insert a chart object into a worksheet, with options.

worksheet_insert_image
lxw_error worksheet_insert_image(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, char* filename)

@brief Insert an image in a worksheet cell.

worksheet_insert_image_opt
lxw_error worksheet_insert_image_opt(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, char* filename, lxw_image_options* options)

@brief Insert an image in a worksheet cell, with options.

worksheet_merge_range
lxw_error worksheet_merge_range(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t last_row, lxw_col_t last_col, char* string, lxw_format* format)

@brief Merge a range of cells.

worksheet_print_across
void worksheet_print_across(lxw_worksheet* worksheet)

@brief Set the order in which pages are printed.

worksheet_print_area
lxw_error worksheet_print_area(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t last_row, lxw_col_t last_col)

@brief Set the print area for a worksheet.

worksheet_print_row_col_headers
void worksheet_print_row_col_headers(lxw_worksheet* worksheet)

@brief Set the option to print the row and column headers on the printed page.

worksheet_protect
void worksheet_protect(lxw_worksheet* worksheet, char* password, lxw_protection* options)

@brief Protect elements of a worksheet from modification.

worksheet_repeat_columns
lxw_error worksheet_repeat_columns(lxw_worksheet* worksheet, lxw_col_t first_col, lxw_col_t last_col)

@brief Set the number of columns to repeat at the top of each printed page.

worksheet_repeat_rows
lxw_error worksheet_repeat_rows(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_row_t last_row)

@brief Set the number of rows to repeat at the top of each printed page.

worksheet_right_to_left
void worksheet_right_to_left(lxw_worksheet* worksheet)

@brief Display the worksheet cells from right to left for some versions of Excel.

worksheet_select
void worksheet_select(lxw_worksheet* worksheet)

@brief Set a worksheet tab as selected.

worksheet_set_column
lxw_error worksheet_set_column(lxw_worksheet* worksheet, lxw_col_t first_col, lxw_col_t last_col, double width, lxw_format* format)

@brief Set the properties for one or more columns of cells.

worksheet_set_column_opt
lxw_error worksheet_set_column_opt(lxw_worksheet* worksheet, lxw_col_t first_col, lxw_col_t last_col, double width, lxw_format* format, lxw_row_col_options* options)

@brief Set the properties for one or more columns of cells with options.

worksheet_set_default_row
void worksheet_set_default_row(lxw_worksheet* worksheet, double height, uint8_t hide_unused_rows)

@brief Set the default row properties.

worksheet_set_first_sheet
void worksheet_set_first_sheet(lxw_worksheet* worksheet)

@brief Set current worksheet as the first visible sheet tab.

worksheet_set_footer
lxw_error worksheet_set_footer(lxw_worksheet* worksheet, char* string)

@brief Set the printed page footer caption.

worksheet_set_footer_opt
lxw_error worksheet_set_footer_opt(lxw_worksheet* worksheet, char* string, lxw_header_footer_options* options)

@brief Set the printed page footer caption with additional options.

worksheet_set_h_pagebreaks
lxw_error worksheet_set_h_pagebreaks(lxw_worksheet* worksheet, lxw_row_t[] breaks)

@brief Set the horizontal page breaks on a worksheet.

worksheet_set_header
lxw_error worksheet_set_header(lxw_worksheet* worksheet, char* string)

@brief Set the printed page header caption.

worksheet_set_header_opt
lxw_error worksheet_set_header_opt(lxw_worksheet* worksheet, char* string, lxw_header_footer_options* options)

@brief Set the printed page header caption with additional options.

worksheet_set_landscape
void worksheet_set_landscape(lxw_worksheet* worksheet)

@brief Set the page orientation as landscape.

worksheet_set_margins
void worksheet_set_margins(lxw_worksheet* worksheet, double left, double right, double top, double bottom)

@brief Set the worksheet margins for the printed page.

worksheet_set_page_view
void worksheet_set_page_view(lxw_worksheet* worksheet)

@brief Set the page layout to page view mode.

worksheet_set_paper
void worksheet_set_paper(lxw_worksheet* worksheet, uint8_t paper_type)

@brief Set the paper type for printing.

worksheet_set_portrait
void worksheet_set_portrait(lxw_worksheet* worksheet)

@brief Set the page orientation as portrait.

worksheet_set_print_scale
void worksheet_set_print_scale(lxw_worksheet* worksheet, uint16_t scale)

@brief Set the scale factor for the printed page.

worksheet_set_row
lxw_error worksheet_set_row(lxw_worksheet* worksheet, lxw_row_t row, double height, lxw_format* format)

@brief Set the properties for a row of cells.

worksheet_set_row_opt
lxw_error worksheet_set_row_opt(lxw_worksheet* worksheet, lxw_row_t row, double height, lxw_format* format, lxw_row_col_options* options)

@brief Set the properties for a row of cells.

worksheet_set_selection
void worksheet_set_selection(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t last_row, lxw_col_t last_col)

@brief Set the selected cell or cells in a worksheet:

worksheet_set_start_page
void worksheet_set_start_page(lxw_worksheet* worksheet, uint16_t start_page)

@brief Set the start page number when printing.

worksheet_set_tab_color
void worksheet_set_tab_color(lxw_worksheet* worksheet, lxw_color_t color)

@brief Set the color of the worksheet tab.

worksheet_set_v_pagebreaks
lxw_error worksheet_set_v_pagebreaks(lxw_worksheet* worksheet, lxw_col_t[] breaks)

@brief Set the vertical page breaks on a worksheet.

worksheet_set_zoom
void worksheet_set_zoom(lxw_worksheet* worksheet, uint16_t scale)

@brief Set the worksheet zoom factor.

worksheet_split_panes
void worksheet_split_panes(lxw_worksheet* worksheet, double vertical, double horizontal)

@brief Split a worksheet into panes.

worksheet_split_panes_opt
void worksheet_split_panes_opt(lxw_worksheet* worksheet, double vertical, double horizontal, lxw_row_t top_row, lxw_col_t left_col)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
worksheet_write_array_formula
lxw_error worksheet_write_array_formula(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t last_row, lxw_col_t last_col, char* formula, lxw_format* format)

@brief Write an array formula to a worksheet cell.

worksheet_write_array_formula_num
lxw_error worksheet_write_array_formula_num(lxw_worksheet* worksheet, lxw_row_t first_row, lxw_col_t first_col, lxw_row_t last_row, lxw_col_t last_col, char* formula, lxw_format* format, double result)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
worksheet_write_blank
lxw_error worksheet_write_blank(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, lxw_format* format)

@brief Write a formatted blank worksheet cell.

worksheet_write_boolean
lxw_error worksheet_write_boolean(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, int value, lxw_format* format)

@brief Write a formatted boolean worksheet cell.

worksheet_write_datetime
lxw_error worksheet_write_datetime(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, lxw_datetime* datetime, lxw_format* format)

@brief Write a date or time to a worksheet cell.

worksheet_write_formula
lxw_error worksheet_write_formula(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, char* formula, lxw_format* format)

@brief Write a formula to a worksheet cell.

worksheet_write_formula_num
lxw_error worksheet_write_formula_num(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, char* formula, lxw_format* format, double result)

@brief Write a formula to a worksheet cell with a user defined result.

worksheet_write_number
lxw_error worksheet_write_number(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, double number, lxw_format* format)

@brief Write a number to a worksheet cell.

worksheet_write_string
lxw_error worksheet_write_string(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, char* string, lxw_format* format)

@brief Write a string to a worksheet cell.

worksheet_write_url
lxw_error worksheet_write_url(lxw_worksheet* worksheet, lxw_row_t row, lxw_col_t col, char* url, lxw_format* format)

@param worksheet pointer to a lxw_worksheet instance to be updated. @param row The zero indexed row number. @param col The zero indexed column number. @param url The url to write to the cell. @param format A pointer to a Format instance or NULL.

worksheet_write_url_opt
lxw_error worksheet_write_url_opt(lxw_worksheet* worksheet, lxw_row_t row_num, lxw_col_t col_num, char* url, lxw_format* format, char* string, char* tooltip)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Manifest constants

LXW_BREAKS_MAX
enum LXW_BREAKS_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
LXW_COL_MAX
enum LXW_COL_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
LXW_COL_META_MAX
enum LXW_COL_META_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
LXW_DEF_COL_WIDTH
enum LXW_DEF_COL_WIDTH;

Default column width in Excel

LXW_DEF_ROW_HEIGHT
enum LXW_DEF_ROW_HEIGHT;

Default row height in Excel

LXW_HEADER_FOOTER_MAX
enum LXW_HEADER_FOOTER_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
LXW_MAX_NUMBER_URLS
enum LXW_MAX_NUMBER_URLS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
LXW_PANE_NAME_LENGTH
enum LXW_PANE_NAME_LENGTH;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
LXW_ROW_MAX
enum LXW_ROW_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

lxw_autofilter
struct lxw_autofilter
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_cell
struct lxw_cell
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_col_options
struct lxw_col_options
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_header_footer_options
struct lxw_header_footer_options

@brief Header and footer options.

lxw_image_options
struct lxw_image_options

@brief Options for inserted images

lxw_merged_range
struct lxw_merged_range
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_panes
struct lxw_panes
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_print_area
struct lxw_print_area
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_protection
struct lxw_protection

@brief Worksheet protection options.

lxw_repeat_cols
struct lxw_repeat_cols
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_repeat_rows
struct lxw_repeat_rows
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_row
struct lxw_row
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_row_col_options
struct lxw_row_col_options

@brief Options for rows and columns.

lxw_selection
struct lxw_selection
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_table_rows
struct lxw_table_rows
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
lxw_worksheet
struct lxw_worksheet

@brief Struct to represent an Excel worksheet.

lxw_worksheet_init_data
struct lxw_worksheet_init_data
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Meta