tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

sheet_view::show_grid_lines Function doesn't work #554

Open Jaf932074323 opened 3 years ago

Jaf932074323 commented 3 years ago

Use the following code: xlnt::workbook wb; xlnt::worksheet ws = wb.active_sheet(); ws.cell("A1").value(5); ws.cell("B2").value("string data"); ws.cell("C3").formula("=RAND()"); ws.merge_cells("C3:C4"); ws.freeze_panes("A1");

xlnt::sheet_view sv = ws.view();
sv.show_grid_lines(false);
sv.default_grid_color(false);
sv.type(xlnt::sheet_view_type::page_break_preview);

std::string m_strFile = CCommonFunction::GetSystemTime("%Y_%m_%d_%H_%M_%S");
m_strFile += ".xlsx";
std::string strErr;
wb.save(m_strFile);

But the Gridlines will still display. How do I remove Gridlines? The result: 1618454324(1)

Desired result: _6D9(GT)R_91W4RJP (~B$J

Blakjak88 commented 3 years ago

I confirm this bug in the VCPKG v1.5 version. There is no code in the xlsx_producer.cpp that adds the showGridLines attribute to the <sheetView>

I have made a patch for this bug for myself. In case you are interested attached are the patch file and the modified portfile.cmake. (Note remove the .TXT extension as I had to add this to upload it here.)

You need to

1) save these files in your vcpkg\ports\xlnt directory. 2) run: vcpkg remove xlnt 3) run: vcpkg install xlnt

fix-showGridLines.patch.txt

portfile.cmake.txt

Hope this helps.