<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <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 (see comment 13)"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=130104#c17">Comment # 17</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 (see comment 13)"
   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>My bad...

It was not FILEOPEN, it is FILESAVE.

On XLSX import the indent is correctly detected (as integer value such as "1"),
and is converted to a value which is 3 times the width of space in 100mm (such
as 528), in
<a href="https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/stylesbuffer.cxx?r=9964531f#1186">https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/stylesbuffer.cxx?r=9964531f#1186</a>
<span class="quote">> sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, Unit::Space );</span >

However, when you now save the document, the width value in 100mm unit is then
converted to the following:
<a href="https://opengrok.libreoffice.org/xref/core/sc/source/filter/excel/xestyle.cxx?r=b8cfea65#1461">https://opengrok.libreoffice.org/xref/core/sc/source/filter/excel/xestyle.cxx?r=b8cfea65#1461</a>
<span class="quote">> nTmpIndent = (nTmpIndent + 100) / 200;</span >
The comment in this line says "1 Excel unit == 10 pt == 200 twips", so this
100mm unit value is treated as pt and converted to twips. The problem is that
in xlsx file the indent value should be an integer number such, of which "1"
means 3 space width, as correctly used in
sc/source/filter/oox/stylesbuffer.cxx:1186.

So the solution would be convert back the 100mm unit value to int value, which
is a reverse operation of the import calculation. I see there is
UnitConverter::scaleFromMm100 function in 
<a href="https://opengrok.libreoffice.org/s?refs=scaleFromMm100&project=core">https://opengrok.libreoffice.org/s?refs=scaleFromMm100&project=core</a>
which can do this.</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>