Open monolied opened 1 year ago
I want it to do SOMETHING but the module appears to do SOMETHING_ELSE.
Just kidding. :)
:-)
Thanks for the report. There probably should be more validation checks on the rich string input. I think some of these are caught in the Python version for comparison.
I presume you don't expect any of these to be valid and are highlighting that they should be rejected by the library. Is that right?
Hm. Yes, I guess that's what I'd expect. Or the rules of engagement explained in the docs when it comes to using write_rich_string(). Ideally, I imagine, consecutive formats would just contain the defined values and merge. Don't know if that's madness, haven't thought it entirely through. I was starting to implement something like that on top, that's how it came to that. (And empty strings might well be silently dropped.) I stumbled on all of this converting external input, of course.
Hm. Yes, I guess that's what I'd expect. Or the rules of engagement explained in the docs when it comes to using write_rich_string().
The rules of engagement are described here: Excel::Writer::XLSX worksheet.write_rich_string()
although the Python docs do a slightly better job of explaining: XlsxWriter worksheet.write_rich_string()
. In particular it highlights some of the things to avoid:
Note Excel doesn’t allow the use of two consecutive formats in a rich string or an empty string fragment. For either of these conditions a warning is raised and the input to
write_rich_string()
is ignored.
In hindsight I made the Perl/Python write_rich_string()
API too permissive and therefore error prone. The Rust version of write_rich_string()
requires the formats and fragments to be tuples which are slightly harder to generate but less error prone.
Hi John, I am using Excel::Writer::XLSX and I have encountered a problem. I want it to do SOMETHING but the module appears to do SOMETHING_ELSE.
Just kidding. :) The following code should be mostly self explanatory. Essentially, certain issues with using formats or empty fields result in several complications. (The "corrupt" aspect is relative. Excel 2016 complains and repairs, LibreOffice 7.3 does not care.) I tried to find open issues related to this, but didn't. I may have failed there. In that case, I apologize.
Great module, btw.
This is with latest libexcel-writer-xlsx-perl package in Debian.