Bug Hunting Session
Bug 101384 - Table borders, alignment and background colors are lost
Summary: Table borders, alignment and background colors are lost
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
5.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Writer-Tables
  Show dependency treegraph
 
Reported: 2016-08-08 11:32 UTC by jvchbabu
Modified: 2018-10-03 21:12 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Source project and source and output files (1.63 MB, application/zip)
2016-08-08 11:33 UTC, jvchbabu
Details
doc and docx files created with Word and the exported HTML from LibreOffice (12.66 KB, application/zip)
2017-03-16 21:26 UTC, Logan B
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jvchbabu 2016-08-08 11:32:26 UTC
We use LibreOffice 5.0.4.2 to create  .docx and .doc documents using UNO Java API.
 We use MS Word 97 filter to produce .doc documents and MS Word 2007 XML  to produce .docx documents.

 We have a table content from HTML file. The table has boarders, right aligned and has background colors to the rows.. 
We have a bookmark  in both .doc and .docx files and used XDocumentInsertable.insertDocumentFromURL API to insert text from HTML file in place of bookmark XTextCursor . 
But generated files shows different output.We observed boarder and background  color and alignment loss.

Doc output(.doc) :
------------
 Boarders are completely invisible, table is left aligned and background colors are lost .

Docx output:
 Boarders are completely visible but table is left aligned and background colors are lost 

 
 Please find project.zip for sample program source html and generated output.
 Let us know if you need more information.
Comment 1 jvchbabu 2016-08-08 11:32:55 UTC
I attached my source project  as eclipse project and attached all source content files, template and sample output files.
 Please follow the below steps:
1) Extract zip file content.
2) Import Libre as java project.
3) Run DocumentGenerator.java by passing full path of template, full path of output file and full path of source html file.
 
Sample  arguments:
   
  "D:\libre\template.doc" "D:\libre\output1.doc" "D:\libre\source_html.html"
4) template and source html files are part of zip file content.

 Please let me know if you have  need any more information.
Comment 2 jvchbabu 2016-08-08 11:33:56 UTC
Created attachment 126668 [details]
Source project and  source and output files
Comment 3 MM 2016-08-28 17:43:39 UTC
(In reply to jvchbabu from comment #0)
> We use LibreOffice 5.0.4.2 to create  .docx and .doc documents using UNO
> Java API.

> 
> Doc output(.doc) :
> ------------
>  Boarders are completely invisible, table is left aligned and background
> colors are lost .
> 

The table alignment set to the left was already in bug 32991
Comment 4 jvchbabu 2016-09-20 09:52:57 UTC
Cloud please look into this bug and provide update. Please let me know if need more information or help in reproducing the issue.
Comment 5 Jean-Baptiste Faure 2016-10-02 10:37:36 UTC
How could you be sure that the problem is on the LibreOffice side and not in your Java code? If the problem is on the LO side, you do not need your Java code to reproduce it.

Best regards. JBF
Comment 6 jvchbabu 2016-10-04 07:03:53 UTC
 We used the JAVA API  provided, then gave you sample program to reproduce the issue.  I am not blaming anybody, I just gave data and sample program to reproduce the issue.
 Could you please let me know if you need more information.
Comment 7 Logan B 2017-03-16 21:25:16 UTC
I can safely replicate this bug using Word 2003 to create a .doc file and Word 2016 to create a .docx file where each contain a table that is 1 cell wide and 2 cells deep, where the first cell has a background colour.

When opening these files with LibreOffice Writer 5.3.0.3 and exporting as HTML, the background colour is added as a separate style attribute in the <td> so it appears as, for example:
<td width="585" valign="top" bgcolor="#d0cece" style="background: #d0cece" style="border: 1px solid #00000a; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.2cm; padding-right: 0.19cm">
The first style attribute is parsed by browsers, showing the background colour, and the second style attribute, containing the border colour and padding, is ignored.

I have attached the files produced by both versions of Word and the HTML output by LibreOffice.

When exporting a .odt created using LibreOffice Writer 5.3.0.3 and recreating the above table, the styles appear all in the same style attribute.
Comment 8 Logan B 2017-03-16 21:26:57 UTC
Created attachment 131949 [details]
doc and docx files created with Word and the exported HTML from LibreOffice
Comment 9 jvchbabu 2017-03-20 14:43:25 UTC
(In reply to Logan B from comment #7)
> I can safely replicate this bug using Word 2003 to create a .doc file and
> Word 2016 to create a .docx file where each contain a table that is 1 cell
> wide and 2 cells deep, where the first cell has a background colour.
> 
> When opening these files with LibreOffice Writer 5.3.0.3 and exporting as
> HTML, the background colour is added as a separate style attribute in the
> <td> so it appears as, for example:
> <td width="585" valign="top" bgcolor="#d0cece" style="background: #d0cece"
> style="border: 1px solid #00000a; padding-top: 0cm; padding-bottom: 0cm;
> padding-left: 0.2cm; padding-right: 0.19cm">
> The first style attribute is parsed by browsers, showing the background
> colour, and the second style attribute, containing the border colour and
> padding, is ignored.
> 
> I have attached the files produced by both versions of Word and the HTML
> output by LibreOffice.
> 
> When exporting a .odt created using LibreOffice Writer 5.3.0.3 and
> recreating the above table, the styles appear all in the same style
> attribute.

Logan B,
 
 In my case I  have html content which has table  and its background color and boarders. We are trying to generate word(doc and docx files)using this html and observed the below :

Doc output(.doc) :
------------
 Boarders are completely invisible, table is left aligned and background colors are lost .

Docx output:
 Boarders are completely visible but table is left aligned and background colors are lost.

You seems to be tried in reverse of my use case, creating a doc and docx and generating HTML out of it.


 Please let me know if my understanding is incorrect and we are ready to extend any help in this regard.
Comment 10 QA Administrators 2018-03-21 03:35:30 UTC Comment hidden (spam)