Bug 148035 - FILEOPEN: DOCX: incorrect formatting of sdt plain text fields (block SDT)
Summary: FILEOPEN: DOCX: incorrect formatting of sdt plain text fields (block SDT)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.8.0
Keywords: bibisected, bisected, regression
: 156552 (view as bug list)
Depends on:
Blocks: DOCX-Content_Control 149240
  Show dependency treegraph
 
Reported: 2022-03-16 13:30 UTC by Xisco Faulí
Modified: 2024-10-28 10:37 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Comparison MSO 2010 and LibreOffice 7.4 master (82.60 KB, image/png)
2022-03-16 13:30 UTC, Xisco Faulí
Details
Controls properties in Word 2013 (91.40 KB, image/png)
2022-04-01 07:30 UTC, Gabor Kelemen (allotropia)
Details
Test file contains fields, which has specific style (4.36 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-10-28 08:54 UTC, Majd Azzam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2022-03-16 13:30:16 UTC
Created attachment 178916 [details]
Comparison MSO 2010 and LibreOffice 7.4 master

Steps to reproduce:
1. Open attachment 55096 [details] from bug 41557
2. Check the first page

-> The font size of the title is too small. See comparison

Reproduced in

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: cfd82e7a2cc2b45b738eb0efa0827196d2de61a4
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2022-03-16 13:31:44 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=b5c616d10bff3213840d4893d13b4493de71fa56

author	Vasily Melenchuk <vasily.melenchuk@cib.de>	2021-11-24 14:50:12 +0300
committer	Thorsten Behrens <thorsten.behrens@allotropia.de>	2021-12-20 00:16:12 +0100
commit b5c616d10bff3213840d4893d13b4493de71fa56 (patch)
tree d96535ffae96f4b0c35aee51a3257770826c8063
parent 302ef0c63b8e95d040cf5b19865e8540e78f9d15 (diff)
tdf#104823: support for sdt plain text fields

Bisected with: bibisect-linux64-7.4

Adding Cc: to Vasily Melenchuk
Comment 2 Xisco Faulí 2022-03-16 14:33:28 UTC
Also reproduced with attachment 52975 [details] from bug 42458
Comment 3 Gabor Kelemen (allotropia) 2022-04-01 07:30:17 UTC
Created attachment 179246 [details]
Controls properties in Word 2013

This has a direct formatting on the character size of 40 pt which is lost and the para style default 11pt is used only.

Same to the next "750 OR" control.

The Author control below has a direct formatting of Bold which is also lost.

Curiously the date control below also has a Bold direct format which is NOT lost on import.
Comment 4 Thorsten Behrens (allotropia) 2022-06-02 10:50:14 UTC
With the ongoing work in that area from Miklos, we're currently standing by (if that doesn't help, will look again)
Comment 5 Miklos Vajna 2022-06-02 11:38:53 UTC
At least attachment 55096 [details] has a document.xml where the SDT is around a table, i.e. a block SDT. My ongoing work is (at the moment) limited to run SDTs, so I'm afraid my effort won't change the problem around this bug.

In other words, SwContentControl is there for run SDTs (and inside that: rich text, checkbox, dropdown, picture & date). Other run SDTs and non-run SDTs behave as they did in the past, at least for now.
Comment 6 Commit Notification 2022-12-13 13:19:37 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/136ee63e37358e94c28b5d8c56f2b244a7a740de

tdf#148035 sw content controls: cursor-move for runSdt only

It will be available in 7.6.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 7 Justin L 2022-12-13 13:27:40 UTC
Comment 6's patch doesn't do much.
"At the moment it does nothing since only runSdt's even call push/pop,
 but at least it might save some trouble later on when block SDTs are
 turned into content controls."
Comment 8 Justin L 2023-08-22 00:16:17 UTC
*** Bug 156552 has been marked as a duplicate of this bug. ***
Comment 9 Justin L 2023-08-22 00:59:47 UTC
A discussion in https://gerrit.libreoffice.org/c/core/+/143818 relates to this:

Miklos says: At some point we'll have to map block sdts to section properties, You have 4 SDT types in Word (Run, Block, Cell, Row IIRC).

mstahl points lots of good stuff in https://gerrit.libreoffice.org/c/core/+/129288.
Comment 10 Miklos Vajna 2023-08-22 06:20:28 UTC
Jaume is looking at better block SDT support. The planned incremental improvement is to focus on the case where we currently map these to input fields & we lose the alias/tag/etc properties. Switching the SwContentControl should be doable: we already drop formatting there with input fields, but this way ~all SDT properties would be handled by Writer natively.

Jaume: once that's in place in general, it may make sense to look at this particular problem in case it still happens.
Comment 11 Xisco Faulí 2023-12-12 10:29:36 UTC
Issue fixed by

author	Jaume Pujantell <jaume.pujantell@collabora.com>	2023-09-13 08:58:21 +0200
committer	Jaume Pujantell <jaume.pujantell@collabora.com>	2023-10-11 15:19:58 +0200
commit 5082d50d24c3fec4487c724a15eb0d54a82ecd0d (patch)
tree 8cae9bc61647c7ba87b53c28d8d4e11269c0fe2c
parent af9c3ed6f748781f2a77e676ffe740992788969b (diff)
writerfilter: use content controls for text in block SDTs

Closing as RESOLVED FIXED.
Comment 12 Commit Notification 2023-12-12 14:26:07 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#148035: sw_ooxmlexport20: Add unittest

It will be available in 24.8.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 13 Majd Azzam 2024-10-28 08:52:41 UTC
Hi,

unfortunately, it still does not work in our case!
I can still see that the formatting of the sdt plain text fields is incorrect.

Please check the file in attachment.
The field should have the Formatvorlage4 style, but it doesn't appear in the preview.
When I open the file in Word, I can see the correct formatting (Formatvorlage4).

This is the SDT block:

      <w:sdt>
        <w:sdtPr>
          <w:rPr>
            <w:rStyle w:val="Formatvorlage4" />
            <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
          </w:rPr>
          <w:alias w:val="Author" />
          <w:tag w:val="" />
          <w:id w:val="519431896" />
          <w:placeholder>
            <w:docPart w:val="477E5E5C83E2482C8987F073F30706BF" />
          </w:placeholder>
          <w:dataBinding
            w:prefixMappings="xmlns:ns0='http://purl.org/dc/elements/1.1/' xmlns:ns1='http://schemas.openxmlformats.org/package/2006/metadata/core-properties' "
            w:xpath="/ns1:coreProperties[1]/ns0:creator[1]"
            w:storeItemID="{6C3C8BC8-F283-45AE-878A-BAB7291924A1}" />
          <w15:color w:val="FF00FF" />
          <w:text />
        </w:sdtPr>
        <w:sdtEndPr>
          <w:rPr>
            <w:rStyle w:val="Formatvorlage4" />
          </w:rPr>
        </w:sdtEndPr>
        <w:sdtContent>
          <w:r w:rsidRPr="00545C0B">
            <w:rPr>
              <w:rStyle w:val="Formatvorlage4" />
              <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
            </w:rPr>
            <w:t>Steinhofer, Melanie</w:t>
          </w:r>
        </w:sdtContent>
      </w:sdt>

Despite having the Formatvorlage4 rStyle in the run properties (rPr), it does not display correctly in the preview!

Steps to Reproduce:
1. Opening the attached Word Document

Actual Results:
2. "Steinhofer, Melanie" is displayed in normal style

Expected Results:
2. "Steinhofer, Melanie" is displayed in Formatvorlage4 style
Comment 14 Majd Azzam 2024-10-28 08:54:16 UTC
Created attachment 197269 [details]
Test file contains fields, which has specific style
Comment 15 Xisco Faulí 2024-10-28 09:22:13 UTC
(In reply to Majd Azzam from comment #14)
> Created attachment 197269 [details]
> Test file contains fields, which has specific style

Hi Majd,
Please, create a new report for your issue.
Comment 16 Majd Azzam 2024-10-28 10:37:10 UTC
Hi,

thank you for the quick response.
This is a new report regarding the problem:

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