Bug 157411 - Loss of font size on round trip from Writer ODF to Writer-web HTML, affects direct formatting less so styled paragraphs
Summary: Loss of font size on round trip from Writer ODF to Writer-web HTML, affects d...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.1.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Michael Stahl (allotropia)
URL: https://ask.libreoffice.org/t/fichier...
Whiteboard: target:24.8.0 target:24.2.4 target:7....
Keywords: bibisected, regression
Depends on:
Blocks:
 
Reported: 2023-09-24 11:28 UTC by JIM7
Modified: 2024-05-09 10:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JIM7 2023-09-24 11:28:02 UTC
Description:
No matter what font or point size I use, when I save to html and then reopen the doc, I get "font name;serif" or "font name;sans serif" at 10 point. 
This makes it difficult for me to read and difficult to further process the document.

Steps to Reproduce:
1.Set font and point size to any document in any format INCLUDING html.
2."Save" document as an html document
3.Re-open document.

Actual Results:
"font name;serif" or "font name;sans serif" at 10 point size

Expected Results:
open document with the Saved Font, at Saved point size


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Document should open to the Saved Font, at Saved point size
Comment 1 V Stuart Foote 2023-09-24 12:20:30 UTC
Sorry, but is this really unexpected?

LibreOffice is not a text editor--and is a pretty poor HTML editor (Writer Web)

When you "round-trip" an ODF document from writer--exporting to HTML (using XHTML filter rules) and then re-import that HMTL back to LO (opening into Writer-Web module) there will be reformatting.

Better way to asses might be to export/save-as to .html and then review the markup that LO filters assign. Any texteditor would do--on Windows notepad++ does a nice job of presenting the markup as exported.

Are the font stanzas being munged there--I just did a test and note that the export filter defaults output css for font for "size=" (HTML4 numeric) and "font-size=" (as points). But there is no font family written.

Meaning on round-trip import opening to Writer-Web module LO template defaults for font and size will be applied.

Kind of seem this is expected.
Comment 2 JIM7 2023-09-26 04:47:46 UTC
"It's not a bug, it's a feature!"
Now where have I heard THAT before?
Comment 3 QA Administrators 2023-09-27 03:15:54 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2023-10-11 10:22:53 UTC
(In reply to JIM7 from comment #0)
> Description:
> No matter what font or point size I use, when I save to html and then reopen
> the doc, I get "font name;serif" or "font name;sans serif" at 10 point. 
> This makes it difficult for me to read and difficult to further process the
> document.
> 
> Steps to Reproduce:
> 1.Set font and point size to any document in any format INCLUDING html.
> 2."Save" document as an html document
> 3.Re-open document.
> 
> Actual Results:
> "font name;serif" or "font name;sans serif" at 10 point size
> 
> Expected Results:
> open document with the Saved Font, at Saved point size

Tested with Save As HTML and I can make it lose the font size definition, if I had used direct character formatting. However, even with char formatting, it doesn't lose the font family. By modifying the paragraph style, both font size and family are retained.

Can you explain in detail what you did?

Arch Linux 64-bit, X11
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1f9cd62b67d679da078c50b4b48295918657a70a
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 11 October 2023
Comment 7 fpy 2024-03-29 21:02:52 UTC
Concerning the change of title for this buzilla, would be interesting to share a reference for "Writer-web HTML".

AFAI'm concerned, I have 
- "File" > "Save" > *"HTML Document (Writer) (.html)"* > test.html
- "File" > "Close"
- "File" > "Recent Documents" > test.html


P.S.
  and indeed, font name changes from "Times New Roman" to "Times New Roman;serif", but I can't see a difference in rendering.
Comment 8 V Stuart Foote 2024-03-29 21:26:29 UTC
For general reference:

Writer-web is the LO module that by default opens .html/.htm with tailored filter import, and shows a Web "layout" of the document and an HTML source view.

Users can explicitly use Writer module to filter open the .html/.htm by selecting the 'HTML Document (Writer) (*.html,*.xhtml,*.htm)' filter from the os/DE file dialog. It opens back to the View -> Normal, provides a Web "layout" but doesn't offer the HTML source view.

But think the loss of direct formatted Font and Font size on HTML filter export, as well as munging the Font of exported paragraph style is more the issue here.
Comment 9 Commit Notification 2024-04-26 11:00:03 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#154581 tdf#157411 tdf#158549 sw: HTML import: fix SfxItemIter reuse

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 10 Michael Stahl (allotropia) 2024-04-26 11:04:34 UTC
reportedly fixed on master
Comment 11 Commit Notification 2024-04-29 16:40:07 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#154581 tdf#157411 tdf#158549 sw: HTML import: fix SfxItemIter reuse

It will be available in 24.2.4.

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 12 Commit Notification 2024-04-29 16:40:14 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

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

tdf#154581 tdf#157411 tdf#158549 sw: HTML import: fix SfxItemIter reuse

It will be available in 7.6.8.

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 Commit Notification 2024-04-29 16:43:24 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-24-2-3":

https://git.libreoffice.org/core/commit/9b5b007df580eaeff2bab2fda9a6cb45e3a3bd24

tdf#154581 tdf#157411 tdf#158549 sw: HTML import: fix SfxItemIter reuse

It will be available in 24.2.3.

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 14 Commit Notification 2024-05-07 16:12:33 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-6-7":

https://git.libreoffice.org/core/commit/598cc6c5f03bf0aae525e80ae6960de2c78efeae

tdf#154581 tdf#157411 tdf#158549 sw: HTML import: fix SfxItemIter reuse

It will be available in 7.6.7.

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 15 Commit Notification 2024-05-09 10:40:51 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0479f870e05d5d231d2d57aaeedff11544bd370c

tdf#154581 tdf#157411 tdf#158549: sw_htmlimport: 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.