I have some font issues while replacing the specified regex expression with some data which is present in a separate document

Hello Team,
I am using

Node dstNode = dstDoc.ImportNode(table, true,ImportFormatMode.KeepSourceFormatting);
dstDoc.LastSection.Body.AppendChild(dstNode);

to replace some content into the document and while doing my source document’s style and font is preserved but only in the place where I use dropdown in my document the style and font is not preserved…

Bug_Explained.docx (53.9 KB)

I have uploaded the images for your reference

@Keerthana_K_R Could you please attach your input documents along with full code or simple console application that will allow us to reproduce the problem? We will check the issue and provide you more information. Unfortunately, it is not possible to analyze the problem using screenshots.

Document srcDoc = new Document(stream);
Document dstDoc = new Document();
var table = srcDoc.FirstSection.Body.Tables[0];
if (table != null)
{
    Node dstNode = dstDoc.ImportNode(table, true,ImportFormatMode.KeepSourceFormatting);
    dstDoc.LastSection.Body.AppendChild(dstNode);
}
dstDoc.Save(documentPath);

this is the code which I used and the source document is -
Source Document.docx (21.7 KB)

Destination document after pasting is

Destination_After_Pasting.docx (36.4 KB)

In the above everything is working perfectly fine but in 2nd row 3rd column Other name(s) is a dropdown which pasting since i used KeepSourceFormatting it should have same font size and font family but in destination document font size is 11 where as in source document it is 10 and some times even the font family of dropdown changes could you help in sorting out this

@Keerthana_K_R Thank you for additional information. The problem is not reproducible on my side using the latest 23.11 version of Aspose.Words. Here is the output produced by your code on my side:
out.docx (14.3 KB)
So, please try using the latest version and let us know if the problem still persists on your side.

Ohh Ok then I will check that and will let you know Thanks for the update😊

1 Like