[Libreoffice-bugs] [Bug 130104] XLSX: cell indent ("stylesheet -> cellXfs -> xf -> alignment: indent") is increased by 3 times upon FILEOPEN, and thus resulted in wrong indent attribute upon FILESAVE

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Jun 26 06:25:19 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=130104

Kevin Suo <suokunlong at 126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|FILESAVE: XLSX: problem     |XLSX: cell indent
                   |with align+indent (cell     |("stylesheet -> cellXfs ->
                   |indent increases on each    |xf -> alignment: indent")
                   |save)                       |is increased by 3 times
                   |                            |upon FILEOPEN, and thus
                   |                            |resulted in wrong indent
                   |                            |attribute upon FILESAVE

--- Comment #13 from Kevin Suo <suokunlong at 126.com> ---
I think I find the reason.

In sc/source/filter/oox/stylesbuffer.cxx:1184-1186, the code is:
>    /*  indentation: expressed as number of blocks of 3 space characters in
>        OOXML. */
>    sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, Unit::Space );

This seems to be wrong code. In case maModel.mnIndent is 0 (i.e., the cell is
set to be no indent), it is fine because 3.0 * 0 is always 0. However, if
maModel.mnIndent is 1, then after calculation it will be 3, which makes the
indent shown to be 3 times wider than what it should be.

Steps to observe the impact of this code:

1. Unzip the simple "test-indent-original.xlsx" file. Go to the stylesheet in
xl/styles.xml.

--> Observe that there are 3 nodes within "cellXfs", and the 3rd one has:

> <alignment horizontal="left" vertical="center" textRotation="0" wrapText="false" indent="1" shrinkToFit="false"/>

this is used by xl/worksheets/sheet1.xml

2. Open this test xlsx file with Calc. Observe that the indent for the cell has
wide indent. If you hit 3 times the "decrease indent" toolbar icon to make it 0
indent, thus I can say that the indent is already set to 3 at the time of
fileopen, although it should be 1.

3. Save as "test-indent-firstSave.xlsx". Then unzip the resaved xlsx file with
Calc, and go to the style sheet.

--> the indent becomes:
> <alignment horizontal="left" vertical="center" textRotation="0" wrapText="false" indent="3" shrinkToFit="false"/>

As discussed on 2 above, this indent was already 3 when the file is opened,
thus it is not a filesave issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210626/759c6123/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list