Page headers are random, when merging by paragraphs with Document Builder.

Oct 28, 2011 at 5:43 AM

I have two documents (document1, document2), one with header and one not.  (Assume document2 has header)

When I merge these two documents by pragraphs, as very well documented in Eric's Blog

Code Snippet -       

            var document1WmlDocument = new WmlDocument(document1);
            var document2WmlDocument = new WmlDocument(document2);

            var staticDataSource = new Source(document2WmlDocument, 0, 10, true);
            var document1Source = new Source(document1WmlDocument, true);
            var document2Source = new Source(document2WmlDocument, 10, true);

            combinedSourceList.Add(staticDataSource);
            combinedSourceList.Add(document1Source);
            combinedSourceList.Add(document2Source);

            // Build and merge the source documents
            DocumentBuilder.BuildDocument(combinedSourceList, “c:\temp\result.docx”);
Result.docx file genrated with few pages having header and few not.

I had run the similar test with slight modification to KeepSections Option (Highligted in Red).
           
            var
staticDataSource = new Source(document2WmlDocument, 0, 10, true);
            var document1Source = new Source(document1WmlDocument, false);
            var document2Source = new Source(document2WmlDocument, 10, true);

This case for obvious, I loose sections, but will preserve headers.  Eric suggested me to diff these both resultant files with SDK tool, unfortunately I haven't seen any difference other than the code snippet for preserving 'Section Break'

This use case seems to be very basic, is it by design ?  Your help will be greatly appreciated. 

(Shared, sample source with Eric, anyone else would like to see sample let me know)

Nov 1, 2011 at 5:21 AM

Surprized that I have not received any suggestions. Can anyone atleast confirm, is it by design (expected behaviour)?