We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Output is incorrect after DOC>HTML>DOCX conversion using Java

I was trying the below code. The idea is to get the changes in sample2.doc as track changes in the original doc. But the original.doc is not getting modified at all. Can anyone please help ??

Document docA = new Document(“D:/sample2.doc”);
Document docB = new Document(“D:/original.doc”);
docB.acceptAllRevisions();
CompareOptions options = new CompareOptions();
options.setIgnoreFormatting(true);
// Relates to Microsoft Word “Show changes in” option in “Compare Documents” dialog box.
options.setTarget(ComparisonTargetType.NEW);

        docB.compare(docA, "user", new Date(), options);

@adutta

Please compare the docA with docB and save the document using docA.Save method.

docA.compare(docB, "user", new Date(), options);

If you still face problem, please ZIP and attach your input and output documents along with expected output document. We will investigate the issue and provide you more information on it.

@tahir.manzoor

Thanks. It worked. But the formatting is getting messed up. SoI have one more question. Can you please guide me regarding this - lets say I have original document B and modified document A. Both these documents have different formatting inside them. I want the changes of document A in the original document B as track changes. Is it possible to copy the track changes of A into B keeping B’s formatting intact. I dont want to create a third document here for compare and merging. I want to consider B as my final result document.

So is there any way to do that in this word aspose ? Can we achieve that using the same save method ? If so then how ?

Document docA = new Document(“D:/modified.docx”);
Document docB = new Document(“D:/original.doc”);
docA.acceptAllRevisions();
docB.acceptAllRevisions();
CompareOptions options = new CompareOptions();
options.setIgnoreFormatting(true);
// Relates to Microsoft Word “Show changes in” option in “Compare Documents” dialog box.
options.setTarget(ComparisonTargetType.NEW);

        docB.compare(docA, "user", new Date(), options);
        docB.save("D:/result.doc");

@adutta

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word documents.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Please find the attached zip source code, input word document output word document and expected word document.poc.zip (10.5 KB)
Aspose_DocToHTML.002.png (12.9 KB)
Aspose_DocToHTML.002.png (12.9 KB)
Aspose_DocToHTML.003.png (650 Bytes)
Aspose_DocToHTML.004.png (2.6 KB)
Aspose_DocToHTML.005.png (192 Bytes)
Aspose_DocToHTML.007.png (160 Bytes)
Aspose_DocToHTML.008.png (144 Bytes)
Aspose_DocToHTML.009.png (144 Bytes)
Aspose_DocToHTML.010.png (188 Bytes)
Aspose_DocToHTML.012.png (193 Bytes)
Aspose_DocToHTML.013.png (177 Bytes)
input_output_and_expected_output.zip (148.3 KB)

Please run the app.java in poc maven project. The issue is - the highlighted portion in the below image should not come when comparing and merging two word documents or when converting word document to html file.
error in generated html.JPG (52.8 KB)

Please revert back to me incase the above things are not clarified or if you need more info.
Also to add one more small issue:-

If in my code i set ignoreFormatting to true in compare options then the bullets are coming as twice in the final merged document . Please find the below attachment as proof.
result_unexpected.zip (41.8 KB)

@tahir.manzoor please check and let me know. Based on this POC we will go for a paid version of aspose words.

@adutta

Thanks for sharing the detail. We are working over your query and will get back to you soon.

@adutta

We have logged this problem in our issue tracking system as WORDSNET-19898. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor

Any tentative date when this is going to get fixed ?? So that we can complete our POC with more test cases like this…

@adutta

We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.

You reported this issue in free support forum and it will be treated with normal priority. To speed up the progress of issue’s resolution, we suggest you please check our paid support policies from following link.
Paid Support Policies

@adutta

It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-19898) as ‘Not a Bug’.

You are saving the document to HTML. The flow formats could not save overlaid pictures from the document model correctly. This issue is related to document format restrictions.