Forum > FPSpreadsheet
How to ignore conditional formatting when not supported by FPSpreadsheet
MAndreato:
Attached there are:
* a simple Test.xlsx: on A1 there is just “a” plus a conditional formatting rule to evidence that A1 is equal to "a" (the default format is red filling with dark red text)
* a little project: on starting it opens the Test.xlsx and when closing it saves the same data into Test2.xlsx
Conditional formatting is not yet supported for Excel OOXML on the stable version 1.12 of FPSpreadsheet, so if you compile and run the project, Test2.xlsx will contain only unformatted “a” – actually that’s fine for me!
However, if I try the app with the latest FPSpreadsheet snapshot; when closing, it raises "Writing conditional font not supported by XLSX writer".
This is because xlsxooxml.pas has the new TsSpreadOOXMLWriter.WriteDifferentialFormats method but it's incomplete.
How can I “bypass” the new incomplete feature?
I tried to comment the call to WriteDifferentialFormats in TsSpreadOOXMLWriter.WriteGlobalFiles but it produces a malformed Test2.xlsx.
wp:
Now I looked into conditional formats again, and found that fpspreadsheet writes empty font names to the xlsx files in case of conditional formatting which Excel does not seem to like. After fixing this the conditional font formats can be read be Excel without any issues, and also your test program works correctly.
Get yourself the latest fpspreadsheet from ccr (snapshot or svn).
MAndreato:
Thanks wp, but testing with the more complex attached xlsx still produces an invalid Test2.xlsx.
(maybe it's not related to conditional formatting)
wp:
That was hard stuff! The xlsx file must have the <conditionalFormattings> node before the <hyperlinks> node - they had been written in reverse order...
Please test the new revision in ccr.
MAndreato:
Well done!
Now we're reaching the next level :D --> see attached
Navigation
[0] Message Index
[#] Next page