Closed LLMIKU closed 2 years ago
However, when I open it on Windows(Excel) ... it shows text is not wrapped
It should work as expected in all versions of Excel. Here is an example program:
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("test.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_format *format = workbook_add_format(workbook);
format_set_text_wrap(format);
worksheet_write_string(worksheet, 0, 0, "It's\na bum\nwrap", format);
workbook_close(workbook);
return 0;
}
Output:
As you can see the test is wrapped as expected.
It may appear differently in other applications but that isn't usually an issue with libxlsxwriter since it follows Excel's format exactly.
One thing to note is that Excel automatically expands the height of the row when the file is opened. This isn't something that is controllable by the file format, it is something that happens at run time when Excel opens the file. So if you don't see that in other applications you may have to specify the row height explicitly.
Anyway, can you test the code above with Excel and confirm you get the same results, or otherwise.
Thanks a lot, I haven't add that format_set_text_wrap(format);
, after added, it works perfect!
Using 1.1.3 now.
Here is the problem:
worksheet_write_string(worksheet, 0, 0, "It's\na bum\nwrap", format);