Ask Your Question

Writer: raw code analyzer?

asked 2019-07-31 10:01:52 +0200

Todd2 gravatar image

updated 2019-08-01 05:34:57 +0200

Hi All,

Is there a raw cod analyser out there for Writer, where can view the raw code and see what the commands and formats are. I am trying to figure out the differences between two documents that act dramatically different but are suppose to be the same.

Many thanks, -T


Hi All,

What is going on is that I can not switch to Portrait from Landscape if I set the first page to landscape.

I reported this over on

Todd: Fedora 30 LibreOffice-6.2.5-Linux_x86-64_rpm.tar.gz

Deiter: Version: (x64) Build-ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159 CPU-Threads: 4; BS: Windows 10.0; UI-Render: GL; VCL: win; Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE

You will see two odt's a attachments on that bug. With Deiter's, I am able to switch without issue. Mine (Todd's), if I set the first page to landscape, I am stuck in landscape. If I set (leave the first page in Portrait, I can do switch orientations with Manual Break without issue, but if I go back and erase the first page so that the second page which is in Landscape is now the first page, everything gets converted to Landscape.

Using fodt, I see in my document (Todd's attachment), after add a second page with default style, and adding the text "page 2" to the document, I get

<text:p text:style-name="P1"/> <text:p text:style-name="P1">Good luck with that!</text:p> <text:p text:style-name="P1"/> <text:p text:style-name="P1"/> <text:p text:style-name="P3">page 2</text:p> <-- manual beak was support to be "Default Style" </office:text> </office:body> </office:document>

And looking up P3, I see

<style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="Standard">

No sign of "Portrait in P3"

And although "pm1" is not used in my document, I see do seelandscape

  <style:page-layout style:name="pm1">
   <style:page-layout-properties fo:page-width="11in" fo:page-height="8.5in" style:num-format="1" style:print-orientation="landscape" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.278in" style:layout-grid-ruby-height="0.139in" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0in">
    <style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>

I do not have a pm2

Looking at Deiter's document, I see pm1 (portrait):

  <style:page-layout style:name="pm1">
   <style:page-layout-properties fo:page-width="8.2681in" fo:page-height="11.6929in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.278in" style:layout-grid-ruby-height ...
edit retag flag offensive close merge delete


I discussed the underlying problem (re:landscape/portrait page style usage in the document) in the referenced tdf#126608.

Mike Kaganski gravatar imageMike Kaganski ( 2019-08-01 05:19:49 +0200 )edit

Hi Mike, I saw you comment and added that the issue is that the side bar and the "Format --> Page --> Page" pull down do not do the same thing. And when using the pull down, pm1 and pm2 are not properly created. Also when the default format is set to Landscape, Manual Break does not toggle Landscape off and Portrait on. For those of us that despise side bars, as they get in our way, the pull down and the side bars need to do EXACTLY the same thing. Please get this on the list to fix. Many thanks, -T

Todd2 gravatar imageTodd2 ( 2019-08-01 07:00:13 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-07-31 10:15:19 +0200

ajlittoz gravatar image

If you want to see how a document is formatted, save it as a "flat XML file" with extension .fodt (note the "f"), then open it with a text editor.

You can also use diff-like utilities to compare files which are supposed to be the same but be prepared for "surprises".

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

edit flag offensive delete link more


Note: the diff utility should be run against the .fodt files not against the original ones.

ajlittoz gravatar imageajlittoz ( 2019-07-31 10:16:48 +0200 )edit

answered 2019-07-31 12:42:38 +0200

Regina gravatar image

updated 2019-08-01 08:52:07 +0200

In this special case, I would not use the flat format, because the flat format has some differences to the packed format, because it has not the possibility to link to internal files. And re-saving will change the documents always, at least in the "last saved date".

Todd2: Unfortunately you do not describe, in which way the documents behave different. So the following tips are more general. Of cause, do all the tips on copies of the files.

  • The packed format is a zip-container. So unzip it, and you can access the internal files and compare them.
  • Test both files in the validator:
  • Look into the 'meta.xml' file of the unpacked document, which application has generated the file. Are they different?
  • Re-save both versions. Do the differences still exist? If yes re-save both versions to strict "ODF 1.2". If they now behave same, then it is likely something in the extended namespaces.
  • Compare the settings of both documents. Settings, which are saved together with the document, are located in the file 'settings.xml' of the unpacked document.
  • Compare the basic styles. They are in the file 'styles.xml' in the unpacked document. Start with 'default-style' and those styles, which have style:name="Standard".
  • Do the documents contain parts, which depend on environment, and the documents have different settings, how to use the environment? Default Language vs explicit set language? Use printer for layout vs layout printer independent? Settings in part Tools > Options > Writer > Compatibility?
  • Do you have set to load printer settings and/or user-specific settings with the document and the documents have different settings stored?
  • (!! use copy of the files) There exist the tool 'Compare Document' in Edit > Track Changes. It generates the differences of the open document to a document on your PC as changes, similar as usual change tracking. It opens the "Manage Changes" window then, where you can see the differences.


After Todd2 has described the original problem, here a solution for that: Please realize, that "Format -> Page -> Page" does not format a single page and does not assign a page style. But it alters the current active page style.

If you have started a new document and you do not want to use the sidebar to set the page style, then use the "page" field in the status bar. The image shows the tooltip of this field. image description

When you right-click the field you get a list of the existing page styles. Select the desired one to start with in your new document. image description

edit flag offensive delete link more


While @Regina's advise is great, I'd still start with fodt, and proceed to this advise only if that simpler step zero didn't help. Because - well, it's easier (while not universal).

Mike Kaganski gravatar imageMike Kaganski ( 2019-07-31 13:28:46 +0200 )edit

Hi Regina,

Wonderful advice. Thank you!

What I have found it that when you use "Format -> Page -> Page", that you are altering the "Document", not the page. You can demonstrate this by opening a new document and immediately going to "Format -> Page -> Page" and setting the orientation to Landscape (what started all of this). You are stuck in Landscape forever after. So I have rewired my brain to think of "Format -> Page as "Format -> Document".

Also, there is a bug in styles drop down that removed Portrait from the list of styles. You can get every other style you want, but not portrait, so yo beet make sure Portrait is you default style or you are stuck in Landscape forever.

to be continued

Todd2 gravatar imageTodd2 ( 2019-08-01 20:57:23 +0200 )edit


The workaround is to go into "Format->Paragraph" and alter the text flow to Landscape (or use the annoying sidebar). This preserves Portrait as the default style. Also note that "format->paragraph" is not altering the paragraph in this instance, it is altering the page. It is a case of knowing when 2+2=5 by design.

I am a consultant. I have LO spread across two counties. My customers mainly use it to read eMail attachments in docx and xlsx and to write recipes and shopping lists. For serious office work, they buy M$ Office. They find LO just to hard to use. Now some of that is "I can't learn anything new" and there is nothing you can do about that, but the rest of it is the 2+2=5 thing. LO is just not intuitive.

You have to know when page = document and when paragraph = page.

Todd2 gravatar imageTodd2 ( 2019-08-01 20:57:43 +0200 )edit

Oh it gets worse! Check out the image I just uploaded to the bug report:

This is the text that went with it:

A graphical representation of one of the bugs to fix.

This graphic show two images -- one on top of the other. The difference is where the cursor is (what page is active). Page 1 are Landscape and page two is Portrait.

Page 1 was set to Landscape by selecting it from the Style pop up at the bottom.

Page 2 was set to Portrait by selecting Landscape from the pop up at the bottom. Chuckle.

On the top image, with the cursor on page 2, it shows the style bar as the "Landscape". Page 2 is obviously Portrait.

On the bottom image, the cursor is on page 1 and the style bar at the bottom says "Default Style".

Oh and the Style ...(more)

Todd2 gravatar imageTodd2 ( 2019-08-01 21:30:04 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-07-31 10:01:52 +0200

Seen: 60 times

Last updated: Aug 01