Thierry

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts

  • Thierry
    Participant

    Hi Michaela,

    I have solved this as follows:
    – Get the SectionProperties of the document to insert
    – Get the SectionProperties of the current section where the new document has to be inserted
    – Copy the SectionProperties of current section where the new document has to be inserted if needed (determined by if the sections are not equal)
    – Insert a Continues Section Break (via a LastRenderedPageBreak) with the copied SectionProperties of the current section
    – Code for inserting the document with DocumentBuilder.BuildDocument
    I have the document to insert declared as follows (syntax VB.NET):
    Dim sourceToInsert As Source = New Source(New WmlDocument(fileName), “InsertFile”)
    sourceToInsert.KeepSections = False
    sourceToInsert.DiscardHeadersAndFootersInKeptSections = False
    – Insert a Continues Section Break (via a LastRenderedPageBreak) with the copied SectionProperties of the document to insert

    I hope you can get something further.

    Kind regards,
    Thierry

    in reply to: List Numbering on Merged Docs #3960

    Thierry
    Participant

    Hi Alan,

    When I adjusted the bullets & numbering of content of the documents that went wrong the problems with the bullets & numbering disappeared 🙂

    So for now the algoritm is working ok, as far I can see. But we will do more testing thoroughly.

    Kind regards,
    Thierry

    in reply to: List Numbering on Merged Docs #3957

    Thierry
    Participant

    Hi Alan,

    I added an extra check when determining the variable highestListNumbering in the algoritm:

    highestListNumbering = Math.Max(highestListNumbering, numberingNumIds.Max(ln => (ln.NumberID.HasValue ? ln.NumberID.Value : 0)));

    is changed to (to prevent a exception when then numberingNumIds has no items):

    if (numberingNumIds.Count > 0)
    highestListNumbering = Math.Max(highestListNumbering, numberingNumIds.Max(ln => (ln.NumberID.HasValue ? ln.NumberID.Value : 0)));

    Kind regards,

    Thierry

    in reply to: List Numbering on Merged Docs #3956

    Thierry
    Participant

    Hi Alan and Trevor,

    I have read this thread carefully and also preprocess the documents before calling DocumentBuilder.BuildDocument via the algoritm of Alan described at September 26, 2016 at 9:44 am.

    Thank you all for the useful information, which have saved me a lot of research time.

    The algoritm is working quite good I must say, however in some cases with numbered and bulleted lists it does not work correctly unfortunately.

    Are you already something further with this issue?
    I will also do some research myself of the algoritm.

    Kind regards,

    Thierry Knijff
    Software Engineer

    in reply to: Word Numbered List #3859

    Thierry
    Participant

    I have the same problems too.

    in reply to: Header/Footer with Different First Page set #3741

    Thierry
    Participant

    Hi Eric,

    I eventually solved the issue.
    The problem was in the ‘template document’. The headers/footers where not for each section defined.
    When this was done, the problem disappeared 🙂
    So when all headers/footers in the sections are correctly defined it works as expected.

    Kind Regards,
    Thierry


    Thierry
    Participant

    Hi Eric,

    Thank you for your response. This is currently no blocker for the project. I have enough other things to do.
    Success with your other project! Please, let me know when you start researching this issue.

    -Thierry

    in reply to: Header/Footer with Different First Page set #3386

    Thierry
    Participant

    Hi Eric,

    Hereby more information on the issue.
    – The template document contains section where the Title Page contains a ’empty’ First Page Header and First Page Footer (so no header and footer is defined for this Title Page). The following pages (page 2 and further) contains a header and footer. In this header and footer the option ‘Different First Page’ is checked.
    – The inserted document has only the default section, which contain one empty header and footer.
    However, I am setting ‘keepSections’ to false, and this section does not show up in the generated document.

    The problem is that the ‘First Page Header’ and ‘First Page Footer’ of the Title Page of the generated document contains the content of the header and footer of second page.

    The three documents (Flow.docx, ~mvi52qa2vp.docx and Out3.docx) can be downloaded at:
    documents

    – Flow.docx ==> template document
    – ~mvi52qa2vp.docx ==> document to insert
    – Out3.docx ==> gegenerated document

    Kind regards,
    Thierry

    in reply to: Header/Footer with Different First Page set #3375

    Thierry
    Participant

    Hi Eric,

    Thank you for your response. The ‘Template.docx’ (source1) has indeed no header/footer for the first page. However, when using the doucmentbuilder to insert a document like this:

    string source1 = “../../Template.docx”;
    string source2 = “../../~mvi52qa2vp.docx”; //Document to insert
    List<Source> sources = null;
    sources = new List<Source>()
    {
    new Source(new WmlDocument(source1), true),
    new Source(new WmlDocument(source2), “InsertFile”)
    };
    DocumentBuilder.BuildDocument(sources, Path.Combine(tempDi.FullName, “Out3.docx”));

    The header/footer of the source1 are kept indeed, however the header/footer appears also in the Title Page.

    This is the result of the ‘SectionProperties’ of ‘Out3.docx’:
    <w:sectPr w:rsidRPr=”009F70F0″ w:rsidR=”009F686A” w:rsidSect=”005C2099″ xmlns:w=”http://schemas.openxmlformats.org/wordprocessingml/2006/main”>
    <w:footerReference w:type=”first” r:id=”Ra87d0c97f7434292″ xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” />
    <w:footerReference w:type=”even” r:id=”Ra2200a8bb40749b4″ xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” />
    <w:headerReference w:type=”first” r:id=”Ra92ab269d2f341d0″ xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” />
    <w:headerReference w:type=”even” r:id=”R0b83a566dd124f96″ xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” />
    <w:headerReference w:type=”default” r:id=”R78559284577b419c” xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” />
    <w:footerReference w:type=”default” r:id=”R481d720143dd4244″ xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” />
    <w:pgSz w:w=”11906″ w:h=”16838″ />
    <w:pgMar w:top=”1205″ w:right=”1418″ w:bottom=”1418″ w:left=”1418″ w:header=”709″ w:footer=”709″ w:gutter=”0″ />
    <w:cols w:space=”720″ />
    <w:titlePg />
    <w:docGrid w:linePitch=”360″ />
    </w:sectPr>

    Is this caused by ‘source2’? For now, I don’t want to use ‘KeepSections’ for this source.
    I tried to set ‘KeepSections’ of source2 to false unfortunately, but this didn’t help.

    I hope you can give me some hints or support for this problem.

    Kind regards,
    Thierry

    in reply to: Insert Document (.docx) in existing document #3370

    Thierry
    Participant

    Hi Eric,

    Eventually, I have found the problem.
    The element of the ‘SectionProperties’ should be the last element of the <Body>-element and not the first element 🙂

    Cheers,
    Thierry

Viewing 10 posts - 1 through 10 (of 10 total)