Bug 72308

Summary: FORMATTING: Better way of .doc to .html conerversion with centering
Product: LibreOffice Reporter: grave_123
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: minor CC: akakunin, dennisroczek, ilmari.lauhakangas
Priority: medium Keywords: filter:html
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=95861
Whiteboard: BSA
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108799    
Attachments: The one of many files that I experience this frustration with in .doc format

Description grave_123 2013-12-04 11:59:03 UTC
Created attachment 90222 [details]
The one of many files that I experience this frustration with in .doc format

Problem description: 

I've been experiencing this for a long time in LibreOffice Writer and frankly I'm tired of it. I help out a client with turning his documents that he wrote in Microsoft Word 2000/2003 into HTML so I can put them up on the Internet. Every single time I convert from a .doc file to .html file, the centering of titles in the document and the like become flush left. Well, after I looked at the page source I immediately started hacking at the problem and discovered that LibreOffice sets some goofy version of the align property and it looks like this:

ALIGN=CENTER

That way does nothing for centering things when converted. What I DID find that works however, is that when there's a <p class> tag

For example:

<P ALIGN=CENTER STYLE="widows: 0; orphans: 0"><B>FOOBAR</B></P>

Will not work. But THIS does center the text:

<P STYLE="widows: 0; orphans: 0; text-align: center"><B>FOOBAR</B></P>


There any way someone can get the Writer to do this instead of that goofy ALIGN=CENTER thing? Thanks :)


My current OS: Ubuntu 13.10
My version of LibreOffice: 4.1.2.3
Browser used: Mozilla Firefox 25.0.1


Steps to reproduce:
1. Open a .doc file in LibreOffice Writer and save it as .html using LibreOffice Writer
2. Open in Firefox
3. Anything meant to be centered is now flush left

Current behavior:

Centered text flushes left

Expected behavior:

Centered text
Operating System: All
Version: unspecified
Comment 1 retired 2013-12-29 12:53:59 UTC
Confirmed:4.2.0.1:OSX

* open attached example file
* save as ... html file
* open html file with LO

Text stays centered.

*But* open html-file with FF, WebKit or Chromium > Text is left.

Not sure if this is expected so > NeedAdvice

and NEW since the described behavior is confirmed.
Comment 2 grave_123 2013-12-29 14:16:48 UTC
(In reply to comment #1)
> Confirmed:4.2.0.1:OSX
> 
> * open attached example file
> * save as ... html file
> * open html file with LO
> 
> Text stays centered.
> 
> *But* open html-file with FF, WebKit or Chromium > Text is left.
> 
> Not sure if this is expected so > NeedAdvice
> 
> and NEW since the described behavior is confirmed.

No, the text is meant to be centered if the "ALIGN=CENTER" is present for that function.

In a nutshell: The desired outcome is to have the text centered not flush left. :)
Comment 3 Joel Madero 2015-05-02 15:41:51 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2015-06-20 14:04:42 UTC
Repro.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 3ecef8cedb215e49237a11607197edc91639bfcd
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-06-19_23:16:58
Locale: fi-FI (fi_FI)
Comment 5 Buovjaga 2016-08-06 19:27:39 UTC
*** Bug 101203 has been marked as a duplicate of this bug. ***
Comment 6 QA Administrators 2017-09-01 11:16:17 UTC Comment hidden (obsolete)
Comment 7 Dennis Roczek 2018-04-03 22:52:36 UTC
still repro with

Version: 6.0.1.1 (x64)
Build-ID: 60bfb1526849283ce2491346ed2aa51c465abfe6
CPU-Threads: 4; BS: Windows 10.0; UI-Render: GL; 
Gebietsschema: de-DE (de_DE); Calc: CL
Comment 8 QA Administrators 2019-04-04 03:03:57 UTC Comment hidden (obsolete)
Comment 9 Dennis Roczek 2020-05-06 17:09:18 UTC
still repro with

Version: 6.4.2.2 (x64)
Build-ID: 4e471d8c02c9c90f512f7f9ead8875b57fcb1ec3
CPU-Threads: 4; BS: Windows 10.0 Build 18363; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: CL
Comment 10 QA Administrators 2022-05-07 03:33:13 UTC Comment hidden (obsolete)
Comment 11 Michael Warner 2022-05-07 11:24:38 UTC
If I create a new document, and set some text centered, I get the HTML output:
<p align="center" style="line-height: 100%; margin-bottom: 0in">
Centered</p>

And when I view this in a web browser, it is centered.

When I open the attached document, and export to HTML, it has align="center" attribute on the <p> tag but is rendered as left-justified (as described in Comment 0). So, in that sense, this is confirmed. 

However, the reason it is justified from the attached document is that the export from the attached document also contains a <style> tag in the header: 
		p { color: #000000; text-align: justify; orphans: 2; widows: 2; direction: ltr; background: transparent }

The text-align:justify style on p is over-riding the align="center" attribute on the element. Looking in LO Writer, I can see that justified alignment is set on the "Text Body" paragraph style.

So, the bug here is that in LO, alignment set directly on text over-rides a paragraph style, but it seems that the opposite is true in HTML. The align="center" attribute is the HTML 4 way to do it, "text-align:center" style is the HTML 5 way. This goes back to the fact that we aren't really generating proper HTML 5 for export. See discussion in Bug 95861.
Comment 12 QA Administrators 2024-05-07 03:15:09 UTC
Dear grave_123,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug
Comment 13 Dennis Roczek 2024-05-15 18:19:27 UTC
The HTML Export looks good now. The source code is much improved (through much room for improvements)

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
CPU threads: 4; OS: macOS 11.7.10; UI render: Skia/Raster; VCL: osx
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Comment 14 Buovjaga 2024-05-15 18:53:12 UTC
(In reply to Dennis Roczek from comment #13)
> The HTML Export looks good now. The source code is much improved (through
> much room for improvements)
> 
> Version: 24.2.3.2 (X86_64) / LibreOffice Community
> Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
> CPU threads: 4; OS: macOS 11.7.10; UI render: Skia/Raster; VCL: osx
> Locale: de-DE (de_DE.UTF-8); UI: de-DE
> Calc: threaded

Centered if done through File - Export, but not when done through File - Save As. Comment 0 and comment 1 did it through Save As.

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 8; OS: Linux 6.8; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
24.2.3-2
Calc: threaded