<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:suokunlong@126.com" title="Kevin Suo <suokunlong@126.com>"> <span class="fn">Kevin Suo</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - XLSX: cell indent ("stylesheet -> cellXfs -> xf -> alignment: indent") is increased by 3 times upon FILEOPEN, and thus resulted in wrong indent attribute upon FILESAVE"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=130104">bug 130104</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Summary</td>
           <td>FILESAVE: XLSX: problem with align+indent (cell indent increases on each save)
           </td>
           <td>XLSX: cell indent ("stylesheet -> cellXfs -> xf -> alignment: indent") is increased by 3 times upon FILEOPEN, and thus resulted in wrong indent attribute upon FILESAVE
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - XLSX: cell indent ("stylesheet -> cellXfs -> xf -> alignment: indent") is increased by 3 times upon FILEOPEN, and thus resulted in wrong indent attribute upon FILESAVE"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=130104#c13">Comment # 13</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - XLSX: cell indent ("stylesheet -> cellXfs -> xf -> alignment: indent") is increased by 3 times upon FILEOPEN, and thus resulted in wrong indent attribute upon FILESAVE"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=130104">bug 130104</a>
              from <span class="vcard"><a class="email" href="mailto:suokunlong@126.com" title="Kevin Suo <suokunlong@126.com>"> <span class="fn">Kevin Suo</span></a>
</span></b>
        <pre>I think I find the reason.

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

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:

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

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:
<span class="quote">> <alignment horizontal="left" vertical="center" textRotation="0" wrapText="false" indent="3" shrinkToFit="false"/></span >

As discussed on 2 above, this indent was already 3 when the file is opened,
thus it is not a filesave issue.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>