Example of adding worksheet headers and footers to worksheets.
#include "xlsxwriter.h"
int main() {
char preview[] = "Select Print Preview to see the header and footer";
char header1[] = "&CHere is some centered text.";
char footer1[] = "&LHere is some left aligned text.";
char header3[] = "&LPage &P of &N" "&CFilename: &F" "&RSheetname: &A";
char footer3[] = "&LCurrent date: &D" "&RCurrent time: &T";
char header4[] = "&C&\"Courier New,Bold\"Hello &\"Arial,Italic\"World";
char footer4[] = "&C&\"Symbol\"e&\"Arial\" = mc&X2";
char header5[] = "&CHeading 1\nHeading 2";
char header6[] = "&CCuriouser && Curiouser - Attorneys at Law";
return 0;
}
uint32_t lxw_row_t
Definition: common.h:41
Struct to represent an Excel workbook.
Definition: workbook.h:293
Struct to represent an Excel worksheet.
Definition: worksheet.h:2115
lxw_workbook * workbook_new(const char *filename)
Create a new workbook object.
lxw_error workbook_close(lxw_workbook *workbook)
Close the Workbook object and write the XLSX file.
lxw_worksheet * workbook_add_worksheet(lxw_workbook *workbook, const char *sheetname)
Add a new worksheet to a workbook.
lxw_error worksheet_set_header(lxw_worksheet *worksheet, const char *string)
Set the printed page header caption.
lxw_error worksheet_set_footer(lxw_worksheet *worksheet, const char *string)
Set the printed page footer caption.
lxw_error worksheet_set_h_pagebreaks(lxw_worksheet *worksheet, lxw_row_t breaks[])
Set the horizontal page breaks on a worksheet.
lxw_error worksheet_set_column(lxw_worksheet *worksheet, lxw_col_t first_col, lxw_col_t last_col, double width, lxw_format *format)
Set the properties for one or more columns of cells.
lxw_error worksheet_set_header_opt(lxw_worksheet *worksheet, const char *string, lxw_header_footer_options *options)
Set the printed page header caption with additional options.
void worksheet_set_margins(lxw_worksheet *worksheet, double left, double right, double top, double bottom)
Set the worksheet margins for the printed page.
lxw_error worksheet_write_string(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string, lxw_format *format)
Write a string to a worksheet cell.