Bug 149240 - DOCX SDT: support for <w:showingPlcHdr>
Summary: DOCX SDT: support for <w:showingPlcHdr>
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 148035
Blocks: DOCX-Content_Control
  Show dependency treegraph
 
Reported: 2022-05-23 09:01 UTC by Vasily Melenchuk (CIB)
Modified: 2023-12-28 14:26 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot showing a problem: Word (above) vs Writer (below) (63.21 KB, image/png)
2022-05-23 14:35 UTC, Vasily Melenchuk (CIB)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasily Melenchuk (CIB) 2022-05-23 09:01:20 UTC
As stated in tdf#148111 currently LO is missing support of SDT property <w:showingPlcHdr> (which placeholder text should be displayed in SDT), so document is not displayed same as in MS Word. 

Moreover, this property is lost on export.

See testcase in sw/qa/extras/ooxmlexport/data/tdf148111.docx
Comment 1 Miklos Vajna 2022-05-23 09:35:37 UTC
Could you be specific if this is run SDT, block SDT, cell SDT or row SDT?

Run SDTs are mapped to content controls on master, and there we import this to SwContentControl::m_bShowingPlaceHolder and export this as well. I didn't change the block/cell/row cases.
Comment 2 Vasily Melenchuk (CIB) 2022-05-23 14:35:55 UTC
Created attachment 180315 [details]
Screenshot showing a problem: Word (above) vs Writer (below)

In source document are only run-level SDTs.

I've checked with recent master. Situation seems better than in my initial report: showingPlcHdr is written in output now.

But given doc still does not display SDTs as in Word. See attached screenshot: empty value from data storage can display either placeholder or just 5 spaces.
Comment 3 Miklos Vajna 2022-05-24 06:29:53 UTC
Aha, I see: your bugdoc has <w:text/> inside <w:sdtPr>, which is not yet mapped to SwContentControl (only rich text, checkbox, dropdown and picture are mapped to that).
Comment 4 Commit Notification 2022-12-09 07:15:09 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/78b5195d8add0679263a5e08ba34be9b27637a65

tdf#149240 docx content controls: round-trip showingPlcHdr better

It will be available in 7.5.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 5 Justin L 2022-12-09 13:17:41 UTC
Please note that my commit is simply for retaining the property on round-trip. The bigger problem of the content control not being a true content control (or whatever is happening here) is still an issue.
Comment 6 Commit Notification 2022-12-09 18:51:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/79944dae026f8f1dbb77ce0ebd13b025e7cddc50

tdf#149240 docx content controls: round-trip showingPlcHdr better

It will be available in 7.5.0.0.beta2.

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 7 Justin L 2023-05-18 14:49:25 UTC Comment hidden (no-value)
Comment 8 Gabor Kelemen (allotropia) 2023-12-28 14:26:23 UTC
This seems to be solved since 7.5 commit

https://git.libreoffice.org/core/+/de90c192cb8f1f03a4028493d8bfe9a127a76b2a

author	Miklos Vajna <vmiklos@collabora.com>	Mon Sep 19 10:01:36 2022 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	Mon Sep 19 11:31:05 2022 +0200

sw content controls, plain text: enable DOCX filter with data binding

The controls are imported as content controls (before they were fields), export also does not lose them, the <w:showingPlcHdr /> tag is also present in the exported file.

Thanks Miklos!