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.
(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
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) and 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
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.
*** Bug 96559 has been marked as a duplicate of this bug. ***
*** Bug 126596 has been marked as a duplicate of this bug. ***
@Regina, any thoughts
Created attachment 153046 [details] OOXML 17.16.5.50 article - STYLEREF STYLEREF is an OOXML ISO/IEC 29500-1 (2016) 17.16.5.59 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.
in LibreOffice 6.4.1 it's still not work correctly
Still not implemented in: Version: 7.0.3.1 (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
Created attachment 179784 [details] sample file with STYLEREF
Some existing documents using STYLEREF in the codebase: sw/qa/extras/ooxmlexport/data/tdf95495.docx sw/qa/extras/ooxmlexport/data/090716_Studentische_Arbeit_VWS.docx sw/qa/extras/ooxmlexport/data/Unsupportedtextfields.docx sw/qa/extras/ooxmlexport/data/multi-page-toc.docx sw/qa/extras/ooxmlexport/data/tdf96750_landscapeFollow.docx sw/qa/extras/odfexport/data/tdf135144.docx
*** Bug 155954 has been marked as a duplicate of this bug. ***
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).
Skyler Grey committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/32c588dd1164aa2fc4c8120ddb74bd510cc082f9 tdf#86790: Add support for a word-style styleref 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.
Created attachment 190393 [details] styleref-all-features2.docx: following reference only on current page. The \l flag indicates "Inserts the nearest text following the field", but apparently that only applies to the current page. If not found below on the current page, it uses an earlier paragraph before checking following pages, as this example shows.
Created attachment 190394 [details] styleref-all-features2_Word2010.pdf
Created attachment 190399 [details] A document showing that \l is only active in marginals (In reply to Justin L from comment #16) > Created attachment 190394 [details] > styleref-all-features2_Word2010.pdf Thanks for your testing and comments! I've checked this and from my testing it looks like - STYLEREF's \l flag is not honored in the body, only in the marginals (so a STYLEREF in the header would search up from the bottom of the page but a STYLEREF in the body would search up regardless of the flag) - You're absolutely right! \l in the marginals searches up on the current page but then it searches as any other marginal STYLEREF would (above the page and then below the page) Thanks again, I'll make another change to fix this so that we can be as compatible as possible
(In reply to Skyler Grey from comment #17) > - STYLEREF's \l flag is not honoured in the body agreed (sounds like a Microsoft bug to me. But we want bug-for-bug compat here) I thought "sections" might come into play somehow, but it doesn't seem to. (I had a Heading 1, then a section break, then a styleref, and then another Heading 1. The styleref pointed to the first Heading - outside of its section, and not to the heading1 inside the section.) That is nice - otherwise it would have been a rather annoying complication.
Created attachment 190408 [details] A file demonstrating the suppress non numerical flag
Is there anything left to fix here? I checked the example files attached here, and the ones mentioned in comment #11 - all seems to open fine, survive saving and reopening in Word. Only exception is sw/qa/extras/odfexport/data/tdf135144.docx but it seems to be kinda broken.
I believe this to be all fixed and in, so I think we can say the task is resolved now. Thanks for the nudge :)