Add support for .fods (flat, human-readable) files#13
Add support for .fods (flat, human-readable) files#13TEParsons wants to merge 4 commits intommulqueen:mainfrom
Conversation
|
@TEParsons Thank you for contributing this, sorry, I must have missed the notification. I'm going to review and merge this soon. I can see that there are some small tweaks that I'd like to make, would you prefer to have feedback and make the changes yourself or are you happy for me to adjust before I merge? |
|
I'm happy for you to adjust before merging :) |
|
@TEParsons What software did you use to test the .fods you were generating? LibreOffice doesn't seem to detect them as fods, it treats them like plain text (as it would a CSV). I've tried generating a .fods in LibreOffice and the resulting file has a different root element to what your code generates (your code: office:document-content, like odswriter puts in content.xml, LibreOffice office:document). |
|
I have what appears to be a working version of this now: https://github.com/mmulqueen/odswriter/tree/fods - would you mind seeing whether it works for you? |
|
Hi, sorry for the slow reply! I was just validating against an XML schema so it makes sense that LibreOffice wouldn't detect the FODS my original code was generating. I think your approach is better and seems to work; so I'm happy for you to pull in that branch instead :) |
FODS is part of the OpenDocument framework, similar to ODS but with flat XML files rather than compressed archives, for human-readability.
As the ODSWriter is already creating an XML DOM and adding data to it, saving to .fods rather than .ods is just a case of writing to a text file rather than a zip file. This PR moves the core functionality of ODSWriter to a base class and splits the saving method into two subclasses (ODSWriter for the current behaviour, FODSWriter for .fods files). The
writermethod chooses the appropriate writer according to file extension.