Checking whether documents are looking the same when they are loaded in Writer has been a problem and needs a lot of manual verifications. When discussing with Florian Reuter more than a year ago, I discovered that he wrote a patch to dump the writer layout as an XML file. This patch helped him to debug layout problems, but Thorsten quickly had the idea to use it to test documents rendering. I finally found some time to improve that layout dumping patch and create a filter for it: it has been pushed yesterday to the master branch (see commits 16431d9, 2ef2ae4 in writer repo and 51398ba in filters repo).

From now LibreOffice can be run from the command line using the--convert-to 'xml:writer_layout_dump' and --outdir options to dump an XML representation of the Writer internal layout objects. The Core And Layout wiki page will help you to understand the resulting XML file, but that one will probably have different pointer values when dumping the same document a second time. In order to fix that, you can normalize the document using some bash script like this one:


for ptr in `xmllint --format $1 | grep 'ptr=' | tr " " "\n" | grep 'ptr=' | sed -e 's/ptr="\(0x[0-9a-z]\+\)"/\1/'`; do
    let id++
    sed -i $1 -e "s/$ptr/$id/g"
unset i

After having normalized the files, running diff on the two files should show the real differences in the layout... and help the testing.