Free Support Forum - aspose.com

Page margins are changed after inserting document into template using C#

Hi,

I have a document with mergefield, footer, header and some information (My.doc in the example)
I want to apply on it, a template (.dot or dotx) (gec.dot in the example)

there is a sample of my code:

Document dot = new Document(@"C:\temp\gec.dot");
Document doc = new Document(@"C:\temp\My.doc");
DocumentBuilder builderDot = new DocumentBuilder(dot);
builderDot.InsertDocument(doc, ImportFormatMode.KeepSourceFormatting);
dot.Save(@"C:\temp\result.doc");

the result is : i have the template’s footer and header, but the margin values is not applyed (it keep the document’s margin values instead of the template’s values).

Furthermore, if the template don’t have footer and/or header, it erase the document’s footer/header.

I use aspose words 17.2

Regards.

@SMES

It seems that you want to insert template document into DOC document. Please ZIP and attach your input documents along with expected output document. We will then provide you more information about your query.

If you want to attach template to document, you can use Document.AttachedTemplate property. This property gets or sets the full path of the template attached to the document.

Hi Tahir,

thanks for your response, you will find the zip with input documents, the program’s result and the expected result.

templatesample.zip (308.7 KB)

Regards

@SMES

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19991. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Could you please share some more detail about this query? We have not found this issue at our end in your shared documents.