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.
newStyle.setName("Caption");
dstDoc.save(MyDir + "FinalDoc_BeforeCopyingContent Out.docx");