Bug 162243 - Masterpage ignored if the first element of the page is a table and it's first cell is another table in LibreOffice Writer.
Summary: Masterpage ignored if the first element of the page is a table and it's first...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Tables
  Show dependency treegraph
 
Reported: 2024-07-29 11:23 UTC by Leonardo da Silva
Modified: 2024-09-06 17:32 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Document with the masterpage setted in table2. (20.01 KB, application/vnd.oasis.opendocument.text)
2024-07-29 11:24 UTC, Leonardo da Silva
Details
Document with the masterpage setted in Table1 (19.26 KB, application/vnd.oasis.opendocument.text)
2024-07-29 11:43 UTC, Leonardo da Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leonardo da Silva 2024-07-29 11:23:38 UTC
Description:
We use BIRT to create our reports, but when creating in ODT format the following happen:

1. Having the Masterpage defined in Table1 and Table1 being the first page element.
2. Having Table2 as first element from the Table1 first cell.

The masterpage from Table1 style will be ignored and the masterpage from Table2 will be taken. 

In the below case, for example, Table1 has the masterpage setted. But Libreoffice will try to take masterpage from Table2, and how it wasn't defined, the default masterpage will be used.

```
<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>
```

```
<office:body>
		<office:text>
			<table:table table:style-name="Table1.Table1">
				<table:table-column table:style-name="Table1.Column1" />
				<table:table-header-rows>
					<table:table-row>
						<table:table-cell table:style-name="Table1.Cell1">
							<table:table table:style-name="Table2.Table2">
								<table:table-column />
								<table:table-row>
									<table:table-cell table:style-name="Table2.Cell2">
										<text:p text:style-name="P1">
```




Steps to Reproduce:
1. In Writer, create a table
2. In the first cell, create another table
3. Try to edit the Table1 properties. The Table2 table properties will be opened instead.


Actual Results:
Libreoffice just ignore the Table1 properties if it's first cell element be another table.

Expected Results:
Don't ignore the Table1 properties.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.4.7.2 (x64) / LibreOffice Community
Build ID: 723314e595e8007d3cf785c16538505a1c878ca5
CPU threads: 8; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win
Locale: pt-BR (pt_BR); UI: pt-BR
Calc: CL
Comment 1 Leonardo da Silva 2024-07-29 11:24:45 UTC
Created attachment 195579 [details]
Document with the masterpage setted in table2.
Comment 2 Leonardo da Silva 2024-07-29 11:43:54 UTC
Created attachment 195580 [details]
Document with the masterpage setted in Table1
Comment 3 Leonardo da Silva 2024-07-29 11:45:00 UTC
Comment on attachment 195580 [details]
Document with the masterpage setted in Table1

If you unzip the document and check content.xml, masterpage is being defined in Table1, but is being ignored.
Comment 4 BogdanB 2024-07-29 18:35:32 UTC
Leonardo, please let the bug in Unconfirmed status until someone else can confirm it. Thanks.
Comment 5 Leonardo da Silva 2024-08-01 16:09:39 UTC
Ok, thanks
Comment 6 Leonardo da Silva 2024-08-05 14:40:09 UTC
Is it a really bug or a business rule?
Comment 7 Buovjaga 2024-09-06 06:25:27 UTC
Please give exact steps on how we can test this with the attached documents.

When I look at the Navigator view in attachment 195580 [details], I see Table1-4 as grayed out and hovering with the mouse shows a tooltip "hidden". There is no apparent way to edit the properties.
Comment 8 Leonardo da Silva 2024-09-06 11:09:51 UTC
Hey Buovjaga, thanks for take a look.

Table1-4 being greyed are ok, the issue is when you try to edit Table5, then the menu to edit Table6 will be opened, not Table5.

The problem is that Table 5 is being ignored because it's first element is another table, then Table6 is selected when I need to select Table5.

As Table5 is ignored, my Masterpage is also, and as Table6 don't have any masterpage setted, then the default pagestyle is used and my document gets unformatted.
Comment 9 Buovjaga 2024-09-06 11:57:26 UTC
(In reply to Leonardo da Silva from comment #8)
> Hey Buovjaga, thanks for take a look.
> 
> Table1-4 being greyed are ok, the issue is when you try to edit Table5, then
> the menu to edit Table6 will be opened, not Table5.
> 
> The problem is that Table 5 is being ignored because it's first element is
> another table, then Table6 is selected when I need to select Table5.
> 
> As Table5 is ignored, my Masterpage is also, and as Table6 don't have any
> masterpage setted, then the default pagestyle is used and my document gets
> unformatted.

Thanks, I confirm it by editing through the Navigator. Already in many older versions, down to 3.5.

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: edc20f4d34d102b385ece53a60abad0047661661
CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded

Unzipping attachment 195580 [details] and looking at the structure in content.xml, it seems Table6 has been inserted into Cell7 of Table5:

<table:table table:style-name="Table4.Table4">
  <table:table-column table:style-name="Table4.Column2"
    table:number-columns-repeated="2" />
  <table:table-column table:style-name="Table4.Column3" />
  <table:table-row>
    <table:table-cell table:style-name="Table4.Cell5">
      <table:table table:style-name="Table5.Table5">
        <table:table-column />
        <table:table-row>
          <table:table-cell table:style-name="Table5.Cell6">
            <text:p text:style-name="P3">
              <text:span text:style-name="T3"></text:span>
            </text:p>
          </table:table-cell>
        </table:table-row>
      </table:table>
    </table:table-cell>
    <table:table-cell table:style-name="Table5.Cell7">
      <table:table table:style-name="Table6.Table6">
        <table:table-column />
        <table:table-row>
          <table:table-cell table:style-name="Table6.Cell8">
            <text:p text:style-name="P3">
              <text:span text:style-name="T3"></text:span>
            </text:p>
          </table:table-cell>
        </table:table-row>
      </table:table>
    </table:table-cell>
...
Comment 10 Leonardo da Silva 2024-09-06 17:32:05 UTC
(In reply to Buovjaga from comment #9)
> (In reply to Leonardo da Silva from comment #8)
> > Hey Buovjaga, thanks for take a look.
> > 
> > Table1-4 being greyed are ok, the issue is when you try to edit Table5, then
> > the menu to edit Table6 will be opened, not Table5.
> > 
> > The problem is that Table 5 is being ignored because it's first element is
> > another table, then Table6 is selected when I need to select Table5.
> > 
> > As Table5 is ignored, my Masterpage is also, and as Table6 don't have any
> > masterpage setted, then the default pagestyle is used and my document gets
> > unformatted.
> 
> Thanks, I confirm it by editing through the Navigator. Already in many older
> versions, down to 3.5.
> 
> Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
> Build ID: edc20f4d34d102b385ece53a60abad0047661661
> CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
> Locale: fi-FI (fi_FI.UTF-8); UI: en-US
> Calc: CL threaded
> 
> Unzipping attachment 195580 [details] and looking at the structure in
> content.xml, it seems Table6 has been inserted into Cell7 of Table5:
> 
> <table:table table:style-name="Table4.Table4">
>   <table:table-column table:style-name="Table4.Column2"
>     table:number-columns-repeated="2" />
>   <table:table-column table:style-name="Table4.Column3" />
>   <table:table-row>
>     <table:table-cell table:style-name="Table4.Cell5">
>       <table:table table:style-name="Table5.Table5">
>         <table:table-column />
>         <table:table-row>
>           <table:table-cell table:style-name="Table5.Cell6">
>             <text:p text:style-name="P3">
>               <text:span text:style-name="T3"></text:span>
>             </text:p>
>           </table:table-cell>
>         </table:table-row>
>       </table:table>
>     </table:table-cell>
>     <table:table-cell table:style-name="Table5.Cell7">
>       <table:table table:style-name="Table6.Table6">
>         <table:table-column />
>         <table:table-row>
>           <table:table-cell table:style-name="Table6.Cell8">
>             <text:p text:style-name="P3">
>               <text:span text:style-name="T3"></text:span>
>             </text:p>
>           </table:table-cell>
>         </table:table-row>
>       </table:table>
>     </table:table-cell>
> ...

Exactly, and then the masterpage that was defined in Table5 is being ignored because Libreoffice is taking Table6 as first element. If bind the masterpage in Table6, then the document will be rendered as it should be.