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

Free Support Forum - aspose.com

Format issue while copy-paste Aspose generated word content


We are generating a word document through Aspose.Words 10.4, generating of document is all fine… but when we copy the content of Aspose generated document to a new blank word document we are loosing all the formatting.(we tried all options like ‘Keep Source Formatting’, ‘Merge Formatting’, ‘Keep Text Only’).
Please find the attached word document that was generated with Aspose, and please suggest if we are missing something obvious while copy-paste.


Hi Ganesh,

Thanks for your inquiry. I would suggest you please upgrade to the latest version (v14.12.0) from here and let us know how it goes on your side. If the problem still remains, please share following detail for investigation purposes.

  • Please attach your input Word document.

  • Please create a standalone/runnable simple Java application that demonstrates the code (Aspose.Words code) you used to generate your output document

  • Please attach the output Word file that shows the undesired behavior.

  • Please attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will investigate as to how you are expecting your final document be generated like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.


Sorry for the late response, We have tried downloading latest JARs and tried, but the issue remains same.
Please find the attached files as requested, please investigate and get back to us.

What we are doing:
Step1: Using ‘template.doc’ as template
Step2: Using ‘DemoFile.java’ aspose java program to generate word (“GeneratedByAsposeProgram.doc”) file
Step3: ‘Select all’ and Ctrl+C content from “GeneratedByAsposeProgram.doc”, open “FinalDoc_BeforeCopyingContent.doc” and Ctrl+V and ‘Save As’ FinalDoc_AfterCopyingContent.doc.

Observation: In “FinalDoc_AfterCopyingContent.doc” Table and its content formatting completely lost but it should look like the table in “GeneratedByAsposeProgram.doc”.
Please advice

Hi Ganesh,

Thanks for sharing the detail. You are facing the expected behavior of Aspose.Words and MS Word. You are facing this issue because there is ‘Caption’ style in GeneratedByAsposeProgram.doc and FinalDoc_BeforeCopyingContent.doc with different properties.

You need to copy the ‘Caption’ style into FinalDoc_BeforeCopyingContent.doc. Please use the following example to achieve your requirements.

If you copy the contents of GeneratedByAsposeProgram.doc into FinalDoc_BeforeCopyingContent Out.docx, you will get the desired output. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "GeneratedByAsposeProgram.doc");
Document dstDoc = new Document(MyDir + "FinalDoc_BeforeCopyingContent.doc");
// The AddCopy method creates a copy of the specified style and automatically generates a new name for the style, such as "Caption_0".
Style newStyle = dstDoc.getStyles().addCopy(doc.getStyles().get("Caption"));
// You can change the new style name if required as the Style.Name property is read-write.
dstDoc.save(MyDir + "FinalDoc_BeforeCopyingContent Out.docx");

Hi Tahir,

We have found another clean and strightforward solution for this issue, please find attached screen capture, if we uncheck Table’s Cell ‘Fit Text’ property, all the format is back to normal, I am not sure if this solution is anyway related to your approach given above.

Now the question, is there any way we can uncheck this through Aspose API? please suggest.


Hi Ganesh,

for your inquiry. Please set the value of CellFormat.FitText property as false to uncheck the ‘Fit text’ check box. Please use following line of code while creating table.


Hi Team,

We have tried but the above suggestion didn’t work, please suggest if you have any solution for this. as this issue impacting our production documents.

We have also tried your suggestion on the sample program attached in my earlier post, but still ‘fittext’ is true.