https://bugs.documentfoundation.org/show_bug.cgi?id=154319

            Bug ID: 154319
           Summary: ToC in DOCX has duplicated LS/LE elements; \d in TOC
                    field gives displaced CI and text elements
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: filter:docx
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 186130
  --> https://bugs.documentfoundation.org/attachment.cgi?id=186130&action=edit
ToC with \s and \d

The attached DOCX has a table of contents, having this field code:

  { TOC \o "1-3" \h \z \u \s chapter \d ":" }

The \s and \d define that there is the numbering and a specific separator
(colon) before the page number [1].

It results in this ToC text:

  1     Ch 1    1:1
  1.1   Subch   1:1
  2     Ch 2    2:1
  3     Ch 3    3:1

Open the attached document in Writer, and inspect the ToC entries. They have
the following structure:

  [LS][LS][E#][E][T][#][CI]":" [LE][LE]

Three problems in this structure:
1. [LS] and [LE] (Hyperlink start/end) are duplicated;
2. The colon is enclosed into double quotes, and is followed by a space;
3. [CI] and the colon are displaced, go after [#], while they must precede it.

The resulting text of the ToC (after update) is:

  1 Ch 1        11":" 
  1.1 Subch     11.1":" 
  2 Ch 2        12":" 
  3 Ch 3        13":" 

Version: 7.5.2.1 (X86_64) / LibreOffice Community
Build ID: e8bf3b441b8370f8440b0339fd9490765a8d57ca
CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL threaded

[1]
https://support.microsoft.com/en-us/office/field-codes-toc-table-of-contents-field-1f538bc4-60e6-4854-9f64-67754d78d05c

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to