2015-12-12 20:16:31 +00:00
|
|
|
/*
|
|
|
|
* Example of how to set Excel worksheet tab colors using libxlsxwriter.
|
|
|
|
*
|
2025-02-11 00:03:36 +00:00
|
|
|
* Copyright 2014-2025, John McNamara, jmcnamara@cpan.org
|
2015-12-12 20:16:31 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "xlsxwriter.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
2016-01-04 19:48:16 +00:00
|
|
|
lxw_workbook *workbook = workbook_new("tab_colors.xlsx");
|
2015-12-12 20:16:31 +00:00
|
|
|
|
|
|
|
/* Set up some worksheets. */
|
|
|
|
lxw_worksheet *worksheet1 = workbook_add_worksheet(workbook, NULL);
|
|
|
|
lxw_worksheet *worksheet2 = workbook_add_worksheet(workbook, NULL);
|
|
|
|
lxw_worksheet *worksheet3 = workbook_add_worksheet(workbook, NULL);
|
|
|
|
lxw_worksheet *worksheet4 = workbook_add_worksheet(workbook, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
/* Set the tab colors. */
|
|
|
|
worksheet_set_tab_color(worksheet1, LXW_COLOR_RED);
|
|
|
|
worksheet_set_tab_color(worksheet2, LXW_COLOR_GREEN);
|
|
|
|
worksheet_set_tab_color(worksheet3, 0xFF9900); /* Orange. */
|
|
|
|
|
|
|
|
/* worksheet4 will have the default color. */
|
|
|
|
worksheet_write_string(worksheet4, 0, 0, "Hello", NULL);
|
|
|
|
|
|
|
|
workbook_close(workbook);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|