Flat XML ODF Spreadsheet (fods) and human-readable diff of content changes

Hi!

I was hoping that LibreOffice is able to maintain a spreadsheet
document in uncompressed XML which I can check-in to a version
control system. With this, I'd like to get a nice visualization of
*content changes*, e.g., by using the version control system
features. This is what I want to achieve.

Storing in uncompressed XML was easy via Flat XML ODF Spreadsheet
(fods). I converted a xlsx file to fods and committed it to a git
repository.

Then I changed once single cell in the fods and committed the
modified file as well.

Unfortunately, I got *many* changes:

    1 file changed, 297 insertions(+), 297 deletions(-)

«git show» shows typical lines like:

Karl Voit wrote:

> Hi!
>
> I was hoping that LibreOffice is able to maintain a spreadsheet
> document in uncompressed XML which I can check-in to a version
> control system. With this, I'd like to get a nice visualization of
> *content changes*, e.g., by using the version control system
> features. This is what I want to achieve.
>
>
> Storing in uncompressed XML was easy via Flat XML ODF Spreadsheet
> (fods). I converted a xlsx file to fods and committed it to a git
> repository.
>
> Then I changed once single cell in the fods and committed the
> modified file as well.
>
> Unfortunately, I got *many* changes:
>
> 1 file changed, 297 insertions(+), 297 deletions(-)
>
> «git show» shows typical lines like:
>
> ,----
> > [...]
> > - <style:style style:name="ce3" style:family="table-cell" style:parent-style-name="Default">
> > + <style:style style:name="ce10" style:family="table-cell" style:parent-style-name="Default">
> > [...]
> > - <table:table-column table:style-name="co21" table:default-cell-style-name="ce11"/>
> > + <table:table-column table:style-name="co21" table:default-cell-style-name="ce18"/>
> > [...]
> `----
>
> Therefore, the user-made changes are drowned within an ocean of
> style-name changes whose purpose is not obvious to me as someone who
> is not an expert in ODF format.
>
> With ...
>
> git show HEAD|grep "^[\+-].*office:value="|grep -v "table:style-name="
>
> ... I was able to reduce the output lines to the content changes only.
>
> 1) How stable is this solution? I.e., is it possible that I exclude
> content changes with this expression as well?
>
> 2) This git/grep method is not feasible for normal end-customers. Is
> there a way to reduce or omit the style-name changes?
>
I have done some experimentation with the fods format. Apparently when you load a .fods file, LibreOffice will invent some style names, which might be different from the style names in the file (if any) that was saved from the .xlsx.

Here are some suggestions that might help (but no guarantee):

(1) Load the .fods and save it again before putting it in the version control system. I.e. start from the .fods file and not from the .xlsx file.

(2) Give your columns (and cells) named custom styles. I.e. define your own cell styles and apply them to your spreadsheet. In this way LO may avoid inventing its own style names.

Hope this helps a bit.