Free Support Forum - aspose.com

Appending Word Doc in ASP.Net 1.0 using C# and ASPOSE


Hi,

I am creating Word Doc in ASP.Net 1.0 using C# and ASPOSE

I have to Append doc file at the end of the destination file after giving some space.

But the code below appends the file in new page in last.

Can you please help me in this

Many Thanks

private void AppendDoc(Document dstDoc, Document srcDoc)
{
for (int i = 0; i < srcDoc.Sections.Count; i++)
{
//First need to import the section into the destination document,
//this translates any document specific lists or styles.
Section section = (Section)dstDoc.ImportNode(srcDoc.Sections[i], true);
dstDoc.Sections.Add(section);
}
}

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think that you should just set SectionStart of first section of source document to bee Continues. Please see the following code:

private void AppendDoc(Document dstDoc, Document srcDoc)

{

srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.Continuous;

for (int i = 0; i < srcDoc.Sections.Count; i++)

{

//First need to import the section into the destination document,

//this translates any document specific lists or styles.

Section section = (Section)dstDoc.ImportNode(srcDoc.Sections[i], true);

dstDoc.Sections.Add(section);

}

}

Hope this helps.

Best regards.

Many Thanks.

It works great