int main() { lxw_workbook *workbook = workbook_new("test_print_options02.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); worksheet_set_paper(worksheet, 9); worksheet->vertical_dpi = 200; worksheet_center_horizontally(worksheet); worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL); return workbook_close(workbook); }
// Test the _write_print_options() function. CTEST(worksheet, write_print_options1) { char* got; char exp[] = "<printOptions horizontalCentered=\"1\"/>"; FILE* testfile = tmpfile(); lxw_worksheet *worksheet = _new_worksheet(NULL); worksheet->file = testfile; worksheet_select(worksheet); worksheet_center_horizontally(worksheet); _worksheet_write_print_options(worksheet); RUN_XLSX_STREQ(exp, got); _free_worksheet(worksheet); }