For some reason, when I generate an ODT, my master page isn’t applied in the first page automatically.
I’m creating this odt by BIRT and I need to know how to improve it.
Yes, I can change it manually in LibreOffice, but the goal is automate the whole process. Is this an issue with the styles.xml? I tried a lot of configs and the first page comes with Default pagestyle everytime.
document.odt (19.4 KB)
Your attached file is empty: it contains a single Default Paragraph Style paragraph and nothing else. The Navigator advertises an hidden table but there is no way to display it.
What should be seen?
What is your OS and LO version?
Wrong document, sorry. I edited the post with the right one.
The issue is with my odt structure, probably with the content.xml file.
I don’t know if it happens because the Table1 is hidden. (If you open the libreoffice, you can see in the explorer that is hidden).
But I have a masterpage style in styles.xml, and in content.xml, my Table 1 is setting it’s layout as my masterpage.
It’s an automated process by BIRT, and it works fine if I have for the second page and so on, because the next tables on the next pages receives a new masterpage with landscape format.
I don’t know what is the cause of this bug, I need to understand why Libreoffice isn’t getting the page-layout from my Table1 to fix the issue.
Ok, I found the issue inside the document, but I still don’t understand the behavior:
In my content.xml, BIRT is setting the masterpage in the first element, Tabela5 (In content.xml is Table1.Table1).
But, the libreoffice is ignoring the Tabela5 and getting the Tabela6 (Table2.Table2) properties. When I try to exclude Tabela5, Tabela6 is excluded and Tabela5 stays there. Why?
If I put the masterpage property in Table6 (Table2.Table2), the formatting is corrected.
I have no idea what BIRT is. Is it a generator? How does it interact with Writer?
I had a look at your sample file. How are the tables created?
To fix your issue you only need to add a Text Flow
parameter in the table properties.
Enable Break With Page Style and select the desired page style from the menu.
BIRT is a report generator. When working with ODT, it creates the XML files manually.
The problem is: BIRT creates the elements and put the masterpage property in the first one of each page. But, in the above case, LibreOffice isn’t getting the masterpage property from the first table, it is completely ignoring it, and getting the next element’s master page, that doesn’t have it setted and consequently gets a Default pagestyle.
Even if I add the TextFlow parameter, it is added in the next element, not in the first, in xml-level context, my issue persists.
If you unzip odt and look at content.xml, you will see the first property setted:
<style:style style:name="Table1.Table1" style:family="table" style:master-page-name="Mp-1-1">
<style:table-properties table:border-model="collapsing" table:align="left"
style:width="11.192in" fo:text-align="start" style:vertical-align="baseline" fo:break-before="page" />
</style:style>
<style:style style:name="Table2.Table2" style:family="table">
<style:table-properties table:border-model="collapsing" table:align="left"
style:width="3.73in" fo:text-align="start" style:vertical-align="baseline" />
</style:style>
And in the body:
<office:body>
<office:text>
<table:table table:style-name="Table1.Table1">
<table:table-column table:style-name="Table1.Column1"
table:number-columns-repeated="2" />
<table:table-column table:style-name="Table1.Column2" />
<table:table-row>
<table:table-cell table:style-name="Table1.Cell1">
<table:table table:style-name="Table2.Table2">
But for some reason, the Table2.Table2 is being used to set masterpage.
IMHO, the problem lies in the use of “table styles”. The concept at least is not mature enough. At worst, presently “table styles” don’t behave like other style categories, i.e. naming them in the table is not sufficient to get application of the settings.
From my experiments, putting style:master-page-name=…
in <table:table …>
fixes the issue. But I don’t know if BIRT can move the attribute from the style to the occurrence (as I know absolutely nothing about BIRT).
Unfortunately BIRT can’t move the attribute from style to body… That’s why my question stands about the styles structure.
What is concerning me is why, if I set the masterpage in next tables, it works.
For example, the property with masterPage is setted in Table1.Table1 is ignored:
<style:style style:name="Table1.Table1" style:family="table" style:master-page-name="Mp-1-1">
<style:table-properties table:border-model="collapsing" table:align="left"
style:width="11.492in" fo:text-align="start" style:vertical-align="baseline" />
</style:style>
<style:style style:name="Table1.Column1" style:family="table-column">
<style:table-column-properties style:column-width="11.492in" />
</style:style>
<style:style style:name="Table1.Cell1" style:family="table-cell">
<style:table-cell-properties style:width="11.0in" style:text-align-source="fix"
fo:padding-bottom="0.0in" fo:padding-top="0.0in" fo:padding-left="0.0in"
fo:padding-right="0.0in" fo:wrap-option="wrap" fo:text-align="center"
style:vertical-align="baseline" />
<style:paragraph-properties fo:text-align="center" style:vertical-align="baseline"
fo:text-indent="0.0in" />
<style:text-properties fo:font-family="Arial" style:font-family-asian="Arial"
style:font-family-complex="Arial" fo:font-size="8.0pt" style:font-size-asian="8.0pt"
style:font-size-complex="8.0pt" fo:color="#000000" fo:letter-spacing="0.0in" />
</style:style>
<style:style style:name="Table2.Table2" style:family="table">
<style:table-properties table:border-model="collapsing" table:align="left"
style:width="11.492in" fo:text-align="center" style:vertical-align="baseline" />
</style:style>
But when I remove from Table1.Table1 and put on Table2.Table2 the document gets totally right, as it should be.
<style:style style:name="Table1.Table1" style:family="table">
<style:table-properties table:border-model="collapsing" table:align="left"
style:width="11.492in" fo:text-align="start" style:vertical-align="baseline" />
</style:style>
<style:style style:name="Table1.Column1" style:family="table-column">
<style:table-column-properties style:column-width="11.492in" />
</style:style>
<style:style style:name="Table1.Cell1" style:family="table-cell">
<style:table-cell-properties style:width="11.0in" style:text-align-source="fix"
fo:padding-bottom="0.0in" fo:padding-top="0.0in" fo:padding-left="0.0in"
fo:padding-right="0.0in" fo:wrap-option="wrap" fo:text-align="center"
style:vertical-align="baseline" />
<style:paragraph-properties fo:text-align="center" style:vertical-align="baseline"
fo:text-indent="0.0in" />
<style:text-properties fo:font-family="Arial" style:font-family-asian="Arial"
style:font-family-complex="Arial" fo:font-size="8.0pt" style:font-size-asian="8.0pt"
style:font-size-complex="8.0pt" fo:color="#000000" fo:letter-spacing="0.0in" />
</style:style>
<style:style style:name="Table2.Table2" style:family="table" style:master-page-name="Mp-1-1">
<style:table-properties table:border-model="collapsing" table:align="left"
style:width="11.492in" fo:text-align="center" style:vertical-align="baseline" />
</style:style>
No other change beside that.
In attach is the same document from the opening topic, but with the masterpage property on Table2.Table2 instead the first one.
content.odt (20.0 KB)
Any suggestions?
Ok… If the first cell from the first table is another table, then Libreoffice will consider the second table as the first one. The case is recursive:
If the first table has in the first cell another table, and the second table has a table in its first cell, then the masterpage from third table will be taken. Is it a correct business rule?