Skip to content

Add support for .fods (flat, human-readable) files#13

Open
TEParsons wants to merge 4 commits into
mmulqueen:mainfrom
TEParsons:main
Open

Add support for .fods (flat, human-readable) files#13
TEParsons wants to merge 4 commits into
mmulqueen:mainfrom
TEParsons:main

Conversation

@TEParsons

Copy link
Copy Markdown

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 writer method chooses the appropriate writer according to file extension.

@mmulqueen

Copy link
Copy Markdown
Owner

@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?

@TEParsons

Copy link
Copy Markdown
Author

I'm happy for you to adjust before merging :)

@mmulqueen

Copy link
Copy Markdown
Owner

@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).

@mmulqueen

Copy link
Copy Markdown
Owner

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?

@TEParsons

Copy link
Copy Markdown
Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants