Bug 148834 - Line numbering for specific paragraphs gets lost after saving to ODT->.docx file format
Summary: Line numbering for specific paragraphs gets lost after saving to ODT->.docx f...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2022-04-28 10:53 UTC by Christian Spaeth
Modified: 2023-08-20 01:37 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Spaeth 2022-04-28 10:53:36 UTC
Description:
Line numbering for specific paragraphs gets lost after saving to .docx (Word 2007-365) file format and reloading.
Line numbering is stored in .odt and .doc (Word 97-2003) file format correctly.
Line numbering for the whole document is stored in .docx file format correctly.
Error happens in specified and older versions.

Steps to Reproduce:
1. Create several paragraphs in a new text document.
2. Add line numbers to specific paragraphs (not the whole document) following this guide: https://help.libreoffice.org/3.3/Writer/Adding_Line_Numbers
3. Save document as .docx (Word 2007-365) and reload it

Actual Results:
No line numbering shown anymore.

Expected Results:
Line numbering shown as before saving.


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: de
Module: StartModule
[Information guessed from browser]
OS: Mac OS X (All)
OS is 64bit: no
Comment 1 Timur 2022-04-29 13:33:36 UTC
Repro for DOCX in 7.4+. Already in LO, same in MSO. Not for DOC.
Comment 2 Justin L 2023-06-08 00:11:03 UTC
Low priority: Things designed in Word seem to round-trip well. Things designed in LO using simple styles seem to work well also.

MS Word has line numbering tied to a section. All paragraphs in a section participate, and require an explicit "suppress line numbers" paragraph property to avoid being numbered.

LO does not tie numbering to page styles or sections AFAICS. It is just on or off for the whole document.

But that sounds like it all should work. What is the problem then? I assume that the property <w:suppressLineNumbers/> is not written when it is false.

Yup - here it is:
    if ( !rNumbering.IsCount( ) )
        m_pSerializer->singleElementNS(XML_w, XML_suppressLineNumbers);

Generally, that is a good thing, but not when it needs to override an inherited value (like in this case where the style says suppress, but the direct formatting says don't suppress).  See ExportPoolItemsToCHP for some ideas on how to check that.
Comment 3 Commit Notification 2023-08-20 01:35:34 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/91358f11ee7e87c8c8290b9507f64d8f90aac3ea

tdf#148834 docxexport: also write suppressLineNumbers = false

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.