Support for tables, filters and color-filling
Hello, I'm using the library for the purpose of writing Excel documents.
I wasn't able to find any mentions of tables or filters in the code, examples, doxygen docs or in any recent issues.
Is it possible to form a worksheet in a similar manner, that would allow opt-out some column values and would allow sorting data on the fly?
If not, are there any plans for it?
I could see that being useful, but it also is likely a non-trivial task, and I currently have to focus on the project that I originally needed OpenXLSX for myself, to finally get that one the road ;) So "maybe later" (tm) I could have a look at it? :)
Hi @easymoney322 - I am going through the backlog of issues - could you provide an example XLSX file that contains a table and some basic filters? Maybe 3-5 columns at most. I'll have a look at the raw XML and think about addressing this then.
Hey, I've grabbed some xlsx previously generated with your library, and added filters to them by selecting cells range and formatting it as a table. This should be the only change between those files, beside maybe metadata things and edit history. WithFilters.xlsx WithoutFilters.xlsx These files contain Russian language and were written by something like this (I haven't seen the code in a last half a year or so)
std::string to_utf8(std::wstring& wide_string)
{
static std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
return utf8_conv.to_bytes(wide_string);
}
wks.row(1).values() = { to_utf8(L"№ п/п"), to_utf8(L"Дата осмотра") ....
I've also just noticed that generated files have Troldal as a file author. Is there a way to change it somehow in the code? I respect the library creator, but I want to avoid people questions about who this is.
Thank you for providing the example files.
Regarding your question about the file authorship:
doc.setProperty(XLProperty::Creator, "aral-matrix");
doc.setProperty(XLProperty::LastModifiedBy, "aral-matrix");
std::cout << "doc creator: " << doc.property(XLProperty::Creator)
<< ", last modified by: " << doc.property(XLProperty::LastModifiedBy)
<< std::endl;
okay, regarding tables functionality, I see it falls in the category of hyperlinks and comments, in that it requires support for worksheet relationships in xl/worksheets/_rels/sheet#.xml.rels:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/table" Target="../tables/table1.xml"/>
</Relationships>
This means I will have to implement the worksheet relationships first of all, over the next days (I am a bit sleep deprived after coding features for 10 hours, then going through 50 open issues last night and updating them ;) - but once I do have them implemented (shouldn't be too hard, as they can be based off of XLRelationships), it will also open the door for proper hyperlink and comment support. :)
Give me a few days.
Worksheet relationships support is in now - I have tables support next on the agenda :)