Free Support Forum - aspose.com

Page layout

Hi,

I am trying to append a Document-B of some Page setup - Y to Document-A of Page setup - X. I need the Document A to contain contents of Document A & B with the Page setup - X. But it differs by one page having Page setup - X and another page with Page setup - Y.

Can you please help me out in achieving uniform Source Page setup after appending

Thanks,

Nithiyanandam

Hi

Thanks for your request. You can try using the following code.

Document docA = new Document(@"418_106265_kannithyan\inA.doc");

Document docB = new Document(@"418_106265_kannithyan\inB.doc");

DocumentBuilder builder = new DocumentBuilder(docA);

foreach (Section section in docB.Sections)

{

builder.MoveToDocumentEnd();

switch (section.PageSetup.SectionStart)

{

case SectionStart.Continuous:

builder.InsertBreak(BreakType.SectionBreakContinuous);

break;

case SectionStart.EvenPage:

builder.InsertBreak(BreakType.SectionBreakEvenPage);

break;

case SectionStart.NewColumn:

builder.InsertBreak(BreakType.SectionBreakNewColumn);

break;

case SectionStart.NewPage:

builder.InsertBreak(BreakType.SectionBreakNewPage);

break;

case SectionStart.OddPage:

builder.InsertBreak(BreakType.SectionBreakOddPage);

break;

}

Section sectionA = (Section)docA.ImportNode(section, true);

builder.CurrentSection.AppendContent(sectionA);

}

docA.Save(@"418_106265_kannithyan\out.doc");

I hope that this will help you.

Best regards.

Yes It works. But I have tables in the doc B which doesnot fit properly in the doc A. The tables goes out of the page. Can you help me out in this.

Thanks in advance.

Hi

Thanks for your inquiry. You can try changing size of tables after importing. Please attach your documents here. I will investigate this problem and try to help you to find solution.

Best regards.

Hi,

The same has been fixed by your explanation. But when i append a document whose contents has Bulleted text, I get additional bullet points without any text. Please refer the attached FinalDoc.Doc. I have appended contents from FieldStartup.doc, NoSpares1stYr.doc, Taxes.doc to FinalDoc.Doc. Can you help me out in removing the additional bullet points.

Source code

Document proposal = new Document("C:\\FinalDoc.Doc");

DocumentBuilder builder = new DocumentBuilder(proposal);

Document appendDocument = new Document("FieldStartup.doc");

foreach (Section section in appendDocument.Sections)

{

builder.MoveToDocumentEnd();

builder.InsertParagraph();

builder.InsertBreak(BreakType.SectionBreakContinuous);

Section sectionA = (Section)proposal.ImportNode(section, true, ImportFormatMode.KeepSourceFormatting);

builder.CurrentSection.AppendContent(sectionA);

}

appendDocument = new Document("NoSpares1stYr.doc");

foreach (Section section in appendDocument.Sections)

{

builder.MoveToDocumentEnd();

builder.InsertParagraph();

builder.InsertBreak(BreakType.SectionBreakContinuous);

Section sectionA = (Section)proposal.ImportNode(section, true, ImportFormatMode.KeepSourceFormatting);

builder.CurrentSection.AppendContent(sectionA);

}

proposal.Save("C:\\FinalDoc.Doc");

--------------------------------------------------------------

Thanks,

Nithiyanandam

Hi

Thanks for your inquiry. I think that you can solve this problem using the following code line.

builder.ParagraphFormat.ClearFormatting();

Insert this line before

builder.InsertParagraph();

I hope that this will help you.

Best regards.