Thu Aug 04, 2016 5:27 pm
That took care of the headers and footers. However, it created two issues.
The first page of my main document is a blank page.
The 4th page of document B, after bullet 20 has a picture. In the original document, the picture is below bullet 20. In the main document, the picture gets pushed to the next page.
I have attached Document A, Document B and the new document Main
Here is the code I am using.
Document oMainDoc = new Document();
Section oSection = oMainDoc.AddSection();
Document oDocumentC = new Document("Document C.docx");
oDocumentC.Replace("#unit", "12345", true, true);
oDocumentC.Replace("#wo", "98765", true, true);
AddDocumentToMainDocument(oDocumentC, oMainDoc);
Document oDocumentB = new Document("Document B.docx");
oDocumentB.Replace("#unit", "23456", true, true);
oDocumentB.Replace("#wo", "87654", true, true);
AddDocumentToMainDocument(oDocumentB, oMainDoc);
oMainDoc.SaveToFile("Main.docx", FileFormat.Docx);
System.Diagnostics.Process.Start("Main.docx");
oMainDoc.SaveToFile("Main.pdf", FileFormat.PDF);
private void AddDocumentToMainDocument(Document pDocument, Document pMaindocument)
{
foreach (Section sec in pDocument.Sections)
{
pMaindocument.Sections.Add(sec.Clone());
}
}
Thanks for the help
Login to view the files attached to this post.