Bug 131594 - FILEOPEN DOCX: Do not display line numbering if w:lnNumType is set but w:countBy="0"
Summary: FILEOPEN DOCX: Do not display line numbering if w:lnNumType is set but w:coun...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium enhancement
Assignee: Xisco Faulí
URL:
Whiteboard: target:7.0.0 target:6.4.4
Keywords:
: 85390 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-03-26 09:57 UTC by Kevin Suo
Modified: 2024-01-16 00:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
test docx file (18.12 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-03-26 09:57 UTC, Kevin Suo
Details
Screenshot in MS Word (116.71 KB, image/png)
2020-03-26 09:58 UTC, Kevin Suo
Details
Screenshot in LibreOffice Writer (158.95 KB, image/png)
2020-03-26 09:58 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2020-03-26 09:57:04 UTC
Created attachment 159036 [details]
test docx file

Steps to Reproduce:

1. Open the attached test docx document in Writer. Observe that the line numbering is displayed every 5 lines.
2. Open this docx document in MSO. Observe that no line numbering is displayed.

-----

The issue is that, when unzip this docx, there is a the following code:

<w:sectPr>
  ...
  <w:lnNumType w:countBy="0" w:distance="360"/>
  ...
</w:sectPr>

The specification explained that w:lnNumType is used to define line numbering. w:countBy="0" is used to specifies the line number increments to be displayed. The problem is, as described in the follow link:

https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/7b579d67-5dd6-4e60-b176-31b8157addd0

Word only allow the countBy value from 1 to 100. The specification allows any int value. As a result, the test document is still valid ooxml document, but in Word no line number would be displayed (because I guess it treat this line as invalid and it is just ignored), while in Writer it treated as valid but does not know what is the exact increment value, thus falls to its default 5 lines.

-----

I assume this is not really a bug of LibreOffice itself, but for interoperability we should treat w:countBy="0" as "line numbering off".

By the way, it seems that the test document was created using WPS Office.

This issue was originally reported on the LibreOffice Chinese discussion forum: https://bbs.libreofficechina.org/forum.php?mod=viewthread&tid=2427
Comment 1 Kevin Suo 2020-03-26 09:58:18 UTC
Created attachment 159037 [details]
Screenshot in MS Word
Comment 2 Kevin Suo 2020-03-26 09:58:53 UTC
Created attachment 159038 [details]
Screenshot in LibreOffice Writer
Comment 3 Xisco Faulí 2020-03-26 10:47:17 UTC
Reproduced in

Version: 7.0.0.0.alpha0+
Build ID: 9163755e9f64a0b1dd5f2090e0702c19e31c12c9
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

Version: 5.2.0.0.alpha1+
Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8)

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 4 Xisco Faulí 2020-03-26 11:01:54 UTC
Hi Kevin,
I might have a fix for this. Do you plan to work on it or can I take it ?
Comment 5 Kevin Suo 2020-03-26 12:01:01 UTC
(In reply to Xisco Faulí from comment #4)
Please go ahead and take it. I know very little about c++ thus I am not able to fix such bugs. Want I am familiar with is building LibreOffice on Linux every day~
Comment 6 Xisco Faulí 2020-03-27 15:00:49 UTC
Patch in gerrit waiting for review: https://gerrit.libreoffice.org/c/core/+/91141
Comment 7 Commit Notification 2020-04-02 12:49:38 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/910197b8cf9b653c1b39b35b73424a36b7c1d1ae

tdf#131594: switch line numbering off if w:countBy="0"

It will be available in 7.0.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.
Comment 8 Commit Notification 2020-04-08 09:33:57 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/de5a0023695584a4c2c5a2729284186d43fc7d82

tdf#131594: switch line numbering off if w:countBy="0"

It will be available in 6.4.4.

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.
Comment 9 Gabor Kelemen (allotropia) 2024-01-16 00:31:12 UTC
*** Bug 85390 has been marked as a duplicate of this bug. ***