How to keep table's style in .docx file when copy it?
realchoi opened this issue · 2 comments
I have a template word file, and there is a table in it with a table-head, now I need to copy a table from it to another, the code is like this:
// Get the first table in my template .docx file
Table table = alltables[0] as Table;
// Create a row(pseudocode)
Row row;
// Add the row
table.Rows.Add(row);
//......Other logic code
// Returns a new .docx file with a table copied from the template file above.
But, the table copied from above template in the .docx file I get at last, which head style is different to my template's table. So, please give me a method to resolve it, thanks.
Hello,
Thank you for your inquiry and sorry for the late response. You can use NodeImporter to copy nodes between documents
https://apireference.aspose.com/net/words/aspose.words/nodeimporter
Use ImportFormatMode.KeepSourceFormatting to keep the original format of the copied node. Hope this helps. Please let us know in case of any issues, you can ask here or better in our official support forum https://forum.aspose.com/c/words.
Best regards,
Alexey.