Another example of adding cell comments to a worksheet. This example demonstrates most of the available comment formatting options.
#include "xlsxwriter.h"
int main() {
"Hold the mouse over this cell to see the comment.",
text_wrap);
"This cell comment is visible.",
text_wrap);
"This cell comment isn't visible until you pass "
"the mouse over it (the default).",
text_wrap);
"This cell comment is visible, explicitly.",
text_wrap);
"This cell comment is also visible because "
"we used worksheet_show_comments().",
text_wrap);
"However, we can still override it locally.",
text_wrap);
"This cell comment is default size.",
text_wrap);
"This cell comment is twice as wide.",
text_wrap);
"This cell comment is twice as high.",
text_wrap);
"This cell comment is scaled in both directions.",
text_wrap);
"This cell comment has width and height specified in pixels.",
text_wrap);
"This cell comment is in the default position.",
text_wrap);
"This cell comment has been moved to another cell.",
text_wrap);
"This cell comment has been shifted within its default cell.",
text_wrap);
"This cell comment has a different color.",
text_wrap);
"This cell comment has the default color.",
text_wrap);
"This cell comment has a different color.",
text_wrap);
"Move the mouse over this cell and you will see 'Cell C3 "
"commented by' (blank) in the status bar at the bottom.",
text_wrap);
"Move the mouse over this cell and you will see 'Cell C6 "
"commented by libxlsxwriter' in the status bar at the bottom.",
text_wrap);
"The height of this row has been adjusted explicitly using "
"worksheet_set_row(). The size of the comment box is "
"adjusted accordingly by libxlsxwriter",
text_wrap);
"The height of this row has been adjusted by Excel when the "
"file is opened due to the text wrap property being set. "
"Unfortunately this means that the height of the row is "
"unknown to libxlsxwriter at run time and thus the comment "
"box is stretched as well.\n\n"
"Use worksheet_set_row() to specify the row height explicitly "
"to avoid this problem.",
text_wrap);
}
Struct to represent an Excel workbook.
Definition: workbook.h:293
Struct to represent an Excel worksheet.
Definition: worksheet.h:2115
#define CELL(cell)
Convert an Excel A1 cell string into a (row, col) pair.
Definition: utility.h:46
lxw_workbook * workbook_new(const char *filename)
Create a new workbook object.
lxw_format * workbook_add_format(lxw_workbook *workbook)
Create a new Format object to formats cells in worksheets.
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_write_comment_opt(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string, lxw_comment_options *options)
Write a comment to a worksheet cell with options.
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_COMMENT_DISPLAY_HIDDEN
Definition: worksheet.h:221
@ LXW_COMMENT_DISPLAY_VISIBLE
Definition: worksheet.h:225
void worksheet_show_comments(lxw_worksheet *worksheet)
Make all comments in the worksheet visible.
lxw_error worksheet_set_row(lxw_worksheet *worksheet, lxw_row_t row, double height, lxw_format *format)
Set the properties for a row of cells.
lxw_error worksheet_write_comment(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string)
Write a comment to a worksheet cell.
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.