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

Free Support Forum - aspose.com

Extra page when appending document

In my code I have two documents. The first document is a template which contains the proper styles, header and footer. The second document contains the data. I then append the second document to the template document, but when I do I see that the first page is blank (besides the header and footer), and the second page has the data. Is there a way that I can remove that first page? Thanks.

Attached is the test code that shows this issue.

Hi Nathan,


Thank you for inquiry. You are trying to append input documents. So, Aspose.Words behaviour is correct. Anyhow you can achieve your requirement by inserting html as below:

Document
tmplDocument = new Document(“C:/temp/test025/template.dotx”);<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder(tmplDocument);

using (StreamReader reader = new StreamReader("C:/temp/test025/data.html"))

{

string html = reader.ReadToEnd();

builder.InsertHtml(html);

builder.Document.Save("C:/temp/test025/Out.doc", SaveFormat.Doc);

}


I hope this will help. In case of any ambiguity, please let me know.


This is exactly what I needed! Thank you very much! :slight_smile: