Closed angelforest closed 6 years ago
Thanks. I've added named range sample to the documentation and it seems to work correctly.
Regarding future bugs: odsfile
is now in the state where it is quite obvious that it has huge limitation because of the way it handles the XML files. The Lua XML library it uses has several ways how to represent the XML data, but the way I choose for this project doesn't allow mixed content XML. The consequence of this is that it can't handle correctly multiple elements in one cell. Like if you have italic and bold text in one cell. This cannot be fixed without complete rewrite.
For this reason, I've started a new project: Luaspreadsheet. It should support XLSX and CSV formats in addition to the ODS. The readers should parse the data to a common format, which will be then rendered with a front-end library. At the moment, I have a XLSX reader, which can read the file and create the intermediate table. The test file shows how it works. It is not really bullet proof yet, but it can already handle stuff like hyperlinks or multiple styles in one cell. It needs an update LuaXML library from Github, because the version on CTAN doesn't contain the new DOM library yet.
tl;dr: using named range sometimes resulted in empty table and other unexpected shenanigans.
When
\includespread
is called, the first this it does is calling\setkeys
, which then processesrange
and callsodsreader.getRange
, which then tries to accessnamedRanges
table, which is empty at this moment and won't be loaded untilodsreader.getTable
is called, which only happens later.So I had to call
getRange
explicitly after table is already loaded.Sidenote: because there is no check if range value is valid or not, misspelling named range still results in weird behavior instead of proper error, and I am not sure what would be a good way to deal with it.