Bug 58194 - FILESAVE Automatic first line indent is not saved in DOC/DOCX format
Summary: FILESAVE Automatic first line indent is not saved in DOC/DOCX format
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://help.libreoffice.org/7.4/en-U...
Whiteboard:
Keywords:
: 34283 130487 (view as bug list)
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2012-12-12 12:53 UTC by Carlos Brys
Modified: 2022-09-09 07:39 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Test document. 1st line have indentation (17.87 KB, application/vnd.oasis.opendocument.text)
2012-12-12 15:00 UTC, Carlos Brys
Details
Original .odt document whith 1st line indented, losed when saved as W97/2003 (11.00 KB, application/msword)
2012-12-12 15:02 UTC, Carlos Brys
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Brys 2012-12-12 12:53:49 UTC
When saving a document in .doc format, all first line indent in paragraphs are lost.
This bug is still present from version 3.0
Comment 1 Urmas 2012-12-12 13:21:31 UTC
Unable to reproduce. Please attach ODF source.
Comment 2 Carlos Brys 2012-12-12 15:00:01 UTC
Created attachment 71392 [details]
Test document. 1st line have indentation

Test document in .odt format-
This document contains indented first lines.
When this is saved in MS-Word 97/2003, all indentations are lost
Comment 3 Carlos Brys 2012-12-12 15:02:48 UTC
Created attachment 71393 [details]
Original .odt document whith 1st line indented, losed when saved as W97/2003
Comment 4 Carlos Brys 2012-12-12 15:07:06 UTC
(In reply to comment #1)
> Unable to reproduce. Please attach ODF source.

I have attached two documents.
The first is a .odt with the first line indented
The second is the same document saved as W97/2003. All indentations are lost
Comment 5 Urmas 2012-12-12 21:52:42 UTC
I see it now.
Comment 6 stfhell 2012-12-13 20:19:55 UTC
Typical case of an export filter simply ignoring a property that the target format doesn't support. The paragraphs are formatted with "automatic indent", which Word does not support.

Also happens with DOCX export. Also reproducible with LO 3.5.4.2.

If you wish to get a Word-compatible first-line indent, you should not use "automatic" but specify an explicit value.
Comment 7 QA Administrators 2015-04-19 03:23:04 UTC Comment hidden (obsolete)
Comment 8 Gordo 2015-04-20 16:19:50 UTC
According to https://help.libreoffice.org/Common/Indents_and_Spacing automatic indent is only when in Writer.  It does not explicitly say it, but this applies only to odt files.

Version: 4.4.2.2
Build ID: c4c7d32d0d49397cad38d62472b0bc8acff48dd6

Changed to RESOLVED NOTABUG.
Comment 9 Kevin Suo 2021-12-22 03:16:05 UTC
Sorry but I set this to NEW. This *is* a bug.

It is true that ooxml does not support "auto" first line indent, but when saving to docx/doc LibreOffice should at least preserve the calculated first line indent value.

For instance, if in an ODT file the first line indent is "auto", and it is calculated that the auto indent value should be "480 twips", in this "480 twips" which equals whatever cm or whatever pt should be written to the docx/doc. Otherwise, it is a format loss.
Comment 10 Kevin Suo 2021-12-22 03:17:52 UTC
Miklos Vajna: What do you think of my comment in comment 9?
Comment 11 Miklos Vajna 2021-12-22 09:48:26 UTC
This sounds reasonable, the Word export filter also bakes calculated layout-level info to the Word output at other places already.
Comment 12 Kevin Suo 2021-12-22 11:02:34 UTC
*** Bug 34283 has been marked as a duplicate of this bug. ***
Comment 13 Kevin Suo 2021-12-22 11:06:52 UTC
*** Bug 130487 has been marked as a duplicate of this bug. ***
Comment 14 Kevin Suo 2021-12-22 11:23:01 UTC
I guess it's in:
DocxAttributeOutput::FormatLRSpace

https://opengrok.libreoffice.org/xref/core/sw/source/filter/ww8/docxattributeoutput.cxx?r=b5c616d1#9227
Comment 15 Kevin Suo 2022-01-30 05:52:11 UTC
I think it's in DocxAttributeOutput::FormatLRSpace.
sw/source/filter/ww8/docxattributeoutput.cxx:9301
https://opengrok.libreoffice.org/xref/core/sw/source/filter/ww8/docxattributeoutput.cxx?r=b5c616d1#9301

where currently it only checks for GetTextFirstLineOffset():
        sal_Int32 const nFirstLineAdjustment = pLRSpace->GetTextFirstLineOffset();
        if (nFirstLineAdjustment > 0)
            pLRSpaceAttrList->add( FSNS( XML_w, XML_firstLine ), OString::number( nFirstLineAdjustment ) );

I think it should also be checking the pLRSpace->IsAutoFirst(), and if true, then nFirstLineAdjustment should be calculated the same way as what we have done in sw/source/core/text/itrcrsr.cxx:250.
https://opengrok.libreoffice.org/xref/core/sw/source/core/text/itrcrsr.cxx?r=0e4bcbb6#250