Hi -
I have the following code used to merge several Word documents into one:
public static byte[] ConvertMultipleDocs2SingleDoc(params Stream[] wordDocStreams)
{
byte[] result = null;
SaveFormat saveFormat = SaveFormat.Doc;
try
{
if (wordDocStreams != null && wordDocStreams.Length > 0)
{
License lic = new License();
lic.SetLicense("TestEnvironmentAsposeWords.Aspose.Words.lic");
DocumentBuilder builder = new DocumentBuilder();
builder.Document.Sections.Clear();
foreach (Stream stream in wordDocStreams)
{
Document document = new Document(stream);
document.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;
foreach (Section section in document)
{
section.PageSetup.SectionStart = SectionStart.NewPage;
section.HeadersFooters.LinkToPrevious(false);
Section newSection = (Section)builder.Document.ImportNode(section, true, ImportFormatMode.KeepSourceFormatting);
builder.Document.Sections.Add(newSection);
}
}
using (MemoryStream ms = new MemoryStream())
{
SaveOptions so = SaveOptions.CreateSaveOptions(saveFormat);
so.PrettyFormat = true;
builder.Document.Save(ms, so);
result = ms.ToArray();
}
}
}
catch (Exception ex)
{
throw new ApplicationException("Error concatenating multiple documents to a single Word file!", ex);
}
return result;
}
The footer of the original document before the merge looks like this:
(see attachment: Aspose footer error INPUT.png)
But the output looks like this:
(see attachment: Aspose footer error OUTPUT.png)
Any ideas what might have happened?