Bug 86790 - Support STYLEREF field fully (so e.g. Chapter fields can be saved to DOCX)
Summary: Support STYLEREF field fully (so e.g. Chapter fields can be saved to DOCX)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium enhancement
Assignee: Skyler Grey
: 96559 126596 155954 (view as bug list)
Depends on:
Blocks: DOCX-Limitations Fields
  Show dependency treegraph
Reported: 2014-11-27 15:24 UTC by sebalis
Modified: 2023-09-05 09:03 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:

OOXML article - STYLEREF (638.41 KB, application/pdf)
2019-07-29 17:57 UTC, V Stuart Foote
sample file with STYLEREF (15.31 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-04-26 10:15 UTC, Xisco Faulí
sample ODT with chapter field (10.50 KB, application/vnd.oasis.opendocument.text)
2023-06-21 11:11 UTC, Stéphane Guillou (stragu)

Note You need to log in before you can comment on or make changes to this bug.
Description sebalis 2014-11-27 15:24:50 UTC
STYLEREF is a useful field in Word, particularly in headers and footers. It looks for the closest paragraph that's formatted with a style whose name is given as a parameter, and inserts the contents of that paragraph.

This field can not currently be created in Writer. When a Word document containing a STYLEREF field is opened in Writer, the current content is shown but the field functionality seems to be gone. Changing the field definition or updating the content after a change to the paragraph that supplied the content is not possible. Although, through some kind of magic, when the document is saved from Writer and then opened in Word it is still a field.

It would be great if STYLEREF could be fully supported. Thanks.
Comment 1 Robinson Tryon (qubit) 2014-12-21 19:01:38 UTC
(In reply to sebalis from comment #0)
> STYLEREF is a useful field in Word, 
> ...
> It would be great if STYLEREF could be fully supported. Thanks.

Sounds like a reasonable step towards compatibility with Word.

Status -> NEW
Severity- > enhancement
Comment 2 Nicolas Saettel 2016-02-19 15:30:08 UTC
Hi all,
Bug 96559 is somewhat related (or a duplicate?), but the other way around:

The styleref field in word is not supported in writer, the other way around would be really nice, i.e.

Inserting a Field & choosing Document/Chapter in a header (showing the chapter number and name of the chapter if style Title 1 is used, for example)
saving the document in a docx format would reproduce the result of doing :

Header and Footer Tools / Design / Field/ StyleRef -> Heading 1 in Word

Right now, the header shows "Chapter", no field
Comment 3 sebalis 2016-02-19 20:08:38 UTC
Interesting thought, but I would really prefer the full flexibility of STYLEREF, where you can use any style to select the paragraph from which the field contents should be derived.
Comment 4 Buovjaga 2016-02-20 15:13:04 UTC
*** Bug 96559 has been marked as a duplicate of this bug. ***
Comment 5 V Stuart Foote 2019-07-29 17:02:08 UTC
*** Bug 126596 has been marked as a duplicate of this bug. ***
Comment 6 V Stuart Foote 2019-07-29 17:18:16 UTC
@Regina, any thoughts
Comment 7 V Stuart Foote 2019-07-29 17:57:12 UTC
Created attachment 153046 [details]

STYLEREF is an OOXML ISO/IEC 29500-1 (2016) defined content formatting field.

Implementing all, or some portion, of its features would improve interoperability of OOXML exchanges but likely requires LibreOffice extension to ODF 1.2/1.3 to save into an ODF document archive.
Comment 8 Roman 2020-02-27 16:20:04 UTC
in LibreOffice 6.4.1 it's still not work correctly
Comment 9 canned 2020-11-05 09:31:44 UTC
Still not implemented in:

Version: (x64)
Build ID: d7547858d014d4cf69878db179d326fc3483e082
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: threaded
Comment 10 Xisco Faulí 2022-04-26 10:15:34 UTC
Created attachment 179784 [details]
sample file with STYLEREF
Comment 11 Xisco Faulí 2022-04-26 10:31:48 UTC
Some existing documents using STYLEREF in the codebase:

Comment 12 Stéphane Guillou (stragu) 2023-06-21 11:09:24 UTC
*** Bug 155954 has been marked as a duplicate of this bug. ***
Comment 13 Stéphane Guillou (stragu) 2023-06-21 11:11:19 UTC
Created attachment 188038 [details]
sample ODT with chapter field

If you save this ODT as a DOCX and reload, the Chapter field is lost (as described in duplicate bug 155954).