Bug 100132 - Formatting loss in replacing bookmark in DOCX file using XDocumentInsertable.insertDocumentFromURL method
Summary: Formatting loss in replacing bookmark in DOCX file using XDocumentInsertable....
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 100060 (view as bug list)
Depends on:
Blocks: Bookmarks
  Show dependency treegraph
 
Reported: 2016-05-30 06:42 UTC by jvchbabu
Modified: 2023-03-18 14:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Source HTML file and generated DOC & DOCX output (6.53 KB, application/zip)
2016-05-30 06:42 UTC, jvchbabu
Details
project zip (1.64 MB, application/zip)
2016-08-02 12:57 UTC, jvchbabu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jvchbabu 2016-05-30 06:42:14 UTC
Created attachment 125384 [details]
Source HTML  file and generated DOC & DOCX output

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 content from HTML file. The first line of text is applied with  Arial Black font family and second text is applied with Calibri . 
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 formatting loss.

Doc output(.doc) :
------------
 Arial Black font family is retained for first line of text.
 Second line of text is changed to Times New Roman font family instead of Calibri font family.

Docx output:
 Arial Black font family is changed to arial black;sans-serif for first line of text and complete format is lost.Even though source font family is arial black;sans-serif, .doc out put able to display it as Arial Black.

 Second line of text is changed to Times New Roman font family instead of Calibri font family.

  This Happening all most all font families.
 Please find attachments.zip for source html and generated output.
 Let us know if you need more information.
Comment 1 Buovjaga 2016-05-31 06:15:07 UTC
(In reply to jvchbabu from comment #0)
>  Let us know if you need more information.

Can you share the Java program you are using to do the conversion?

Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the program.
Comment 2 jvchbabu 2016-08-02 12:56:33 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 3 jvchbabu 2016-08-02 12:57:31 UTC
Created attachment 126518 [details]
project zip
Comment 4 jvchbabu 2016-08-02 12:58:05 UTC Comment hidden (no-value)
Comment 5 jvchbabu 2016-09-20 09:48:04 UTC Comment hidden (no-value)
Comment 6 Cor Nouws 2016-09-26 10:28:53 UTC
*** Bug 100060 has been marked as a duplicate of this bug. ***
Comment 7 Xisco Faulí 2017-08-17 16:19:10 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2018-03-02 10:01:57 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2018-04-04 13:27:17 UTC Comment hidden (obsolete)
Comment 10 BS Dev-Team 2020-09-23 11:07:54 UTC
We reproduced this bug in the latest v7 build.

We are trying to insert a piece of formatted text (ODT -> ODT) using a call similar to

XDocumentInsertable xDocumentInsertable = (XDocumentInsertable)UnoRuntime.queryInterface(XDocumentInsertable.class, xTextCursor);
      if(xDocumentInsertable != null)
        xDocumentInsertable.insertDocumentFromURL(URLAdapter.adaptURL(url), new PropertyValue[0]);
}
(as you can find it in project.zip)

Formatting gets lost / changes
* indents get lost sometimes (especially the first line of inserted text)
* font size of following text changes sometimes (before 9, now 10)

We would really appreciate any thoughts and possible solutions!
Regards
Comment 11 Buovjaga 2020-09-23 11:24:36 UTC
Ok, let's change to new
Comment 12 QA Administrators 2022-09-24 03:41:46 UTC
Dear jvchbabu,

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