Bug 135796 - FILESAVE DOCX/DOC: Highlighting inside textboxes not exported with a odt to DOC/DOCX conversion
Summary: FILESAVE DOCX/DOC: Highlighting inside textboxes not exported with a odt to D...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.0.5 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, implementationError
Depends on:
Blocks: Highlight-Color Shape-ODF-OOXML-export
  Show dependency treegraph
 
Reported: 2020-08-16 09:53 UTC by Telesto
Modified: 2024-11-07 12:13 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (8.36 KB, application/vnd.oasis.opendocument.text)
2020-08-16 09:54 UTC, Telesto
Details
attachment #164345 saved by Writer as docx (4.96 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-10-22 13:24 UTC, NISZ LibreOffice Team
Details
166628 saved by Word after adding highlight color (14.05 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-10-22 13:28 UTC, NISZ LibreOffice Team
Details
Second version of the example file in odt and docx (50.82 KB, image/png)
2020-10-22 13:37 UTC, NISZ LibreOffice Team
Details
Modified example file with shape containing highlighted text (9.77 KB, application/vnd.oasis.opendocument.text)
2020-10-22 13:38 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-08-16 09:53:51 UTC
Description:
FILESAVE DOCX/DOC: Highlighting inside textboxes not exported odt to DOCX conversion

Steps to Reproduce:
1. Open the attached file
2. Save as DOCX/DOC
3. File reload

This strange. If you save ODT to DOC there will be no highlighting. If you edit the doc with Word & save there is highlighting on import. If you edit the highlighting inside the textbox & save it works too.

Highlighting in textboxes is supported for ODT since 4.4. Looks like an implementation error

Actual Results:
Notice there is no highlighting

Expected Results:
Highlighting


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.1.0.0.alpha0+ (x64)
Build ID: <buildversion>
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2020-08-16 09:54:24 UTC
Created attachment 164345 [details]
Example file
Comment 2 Telesto 2020-08-16 09:55:08 UTC
Adding bisect request.. to find the one who implemented it
Comment 3 NISZ LibreOffice Team 2020-10-22 13:23:48 UTC
Confirming with:

Version: 7.1.0.0.alpha0+ (x64)
Build ID: e0c72e31c1d455c26110c35e8780d420e17cdea6
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: CL

This is an editeng textbox, upon exporting it there is this in the xml:

										<w:txbxContent>
			<w:p>
				<w:pPr>
					<w:bidi w:val="0"/>
					<w:rPr/>
				</w:pPr>
				<w:r>
					<w:rPr/>
					<w:t>sdsd</w:t>
				</w:r>
			</w:p>
		</w:txbxContent>

If the saved version is edited in Word, it puts out correctly the tag (I used green highlight):
		<w:txbxContent>
			<w:p w:rsidR="00EE2C44" w:rsidRDefault="002529E3">
				<w:r w:rsidRPr="00D85E2D">
					<w:rPr>
						<w:highlight w:val="green"/>
					</w:rPr>
					<w:t>sdsd</w:t>
				</w:r>
			</w:p>
		</w:txbxContent>

This is also retained by Writer on a new save, but this is now a Writer frame, so probably a bit different part of export core too.
Comment 4 NISZ LibreOffice Team 2020-10-22 13:24:32 UTC
Created attachment 166628 [details]
attachment #164345 [details] saved by Writer as docx
Comment 5 NISZ LibreOffice Team 2020-10-22 13:28:29 UTC
Created attachment 166629 [details]
166628 saved by Word after adding highlight color
Comment 6 NISZ LibreOffice Team 2020-10-22 13:37:55 UTC
Created attachment 166630 [details]
Second version of the example file in odt and docx

Inserting a shape, adding textbox, adding text and highlighting it also saves correctly. Interesting...
Comment 7 NISZ LibreOffice Team 2020-10-22 13:38:54 UTC
Created attachment 166631 [details]
Modified example file with shape containing highlighted text
Comment 8 Aron Budea 2020-11-07 19:16:16 UTC
(In reply to Telesto from comment #2)
> Adding bisect request.. to find the one who implemented it

If the question was when the highlight color in the sample was imported, it started with the following commit. However, at this point I see no way to set highlight color in the text box itself.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=3350fabd23859eb5fdbe77c6db9248866d4e2995
author		Miklos Vajna <vmiklos@collabora.co.uk>	2014-06-30 13:46:04 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-07-01 13:30:12 +0200

SwXAutoStyle::GetPropertyValues_Impl: fix handling of CharAutoStyleName
Comment 9 QA Administrators 2022-11-08 03:48:06 UTC Comment hidden (obsolete)
Comment 10 Дмитрий 2024-11-07 06:09:16 UTC
When saving a DOCX file with highlighted text in LibreOffice 24.8.2, the color is displayed in Word 2010, but colors from LibreOffice's palette cannot be removed using Word's highlighting function. This is because LibreOffice uses the <w:shd> tag for shading, while Word relies on the <w:highlight> tag. Mybe to make this work correctly, LibreOffice should convert its color palette into Word's supported highlight colors and assign appropriate names.

Test Result:
I tested replacing the shading XML line manually in the file saved in LibreOffice, and the highlighting worked correctly in Word 2010.

XML Example:

LibreOffice Output:

<w:rPr>
  <w:highlight w:val="none"/>
  <w:shd w:fill="FCFF2F" w:val="clear"/>
</w:rPr>


Word 2010 Output:

<w:rPr>
  <w:highlight w:val="yellow"/> 
</w:rPr>

Differences:

  LibreOffice uses <w:shd> for shading, while Word uses <w:highlight> for highlighting.
  Colors from LibreOffice's palette need to be converted into Word's predefined colors to ensure they can be applied and removed correctly in Word 2010.

List of Supported Colors in Word 2010:
1  - yellow
2  - green
3  - cyan
4  - blue
5  - red
6  - magenta
7  - black
8  - darkGray
9  - lightGray
10 - turquoise
11 - pink
12 - orange
13 - dark Green
14 - dark Blue
15 - dark Red
16 - none (no highlight)
Comment 11 Дмитрий 2024-11-07 06:17:47 UTC
Additional Information:
It appears that LibreOffice uses the "Shading" option from the "Paragraph" settings to apply background colors (via the <w:shd> tag), which is not recognized by Word as a proper text highlight. Word relies on the "Highlight" function, which is part of the "Font" settings, and uses the <w:highlight> tag to apply color to text.

In LibreOffice, the color applied through "Shading" does not translate directly into Word’s highlight color, causing the text to display a background color rather than being properly highlighted. Therefore, it’s necessary for LibreOffice to convert these shading colors to Word’s predefined highlight colors when exporting to DOCX, ensuring compatibility and correct functionality in Word.

Test Scenario:
When I manually replace the <w:shd> tag in a LibreOffice-exported DOCX file with the appropriate <w:highlight> tag (matching Word’s supported highlight colors), the text highlight appears correctly in Word 2010.

This suggests that LibreOffice needs to implement a conversion between its shading colors and Word’s highlight palette to ensure proper display and functionality of text highlights.
Comment 12 Дмитрий 2024-11-07 12:13:34 UTC
(In reply to Дмитрий from comment #11)
For a more detailed review of the specification, I referred to the ISO/IEC 29500-1:2016 standard. It contains two sections (17.3.2.15 highlight (Text Highlighting) and 17.18.40 ST_HighlightColor (Text Highlight Colors)) that define the file structure for text highlighting.

The specification is publicly available and can be accessed at the following address:
https://standards.iso.org/ittf/PubliclyAvailableStandards/c071691_ISO_IEC_29500-1_2016.zip