Determining Paragraph Indexes

Home Forums Open-Xml-PowerTools Determining Paragraph Indexes

This topic contains 1 reply, has 2 voices, and was last updated by  Eric White 8 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3665

    Eric White
    Keymaster

    Hi,

    If you look at line 431 in DocumentBuilder.cs, you can see where it selects the content to be included in a source document:

        List<XElement> contents = doc.MainDocumentPart.GetXDocument()
            .Root
            .Element(W.body)
            .Elements()
            .Skip(source.Start)
            .Take(source.Count)
            .ToList();

    If you are not seeing what you want in the merged document, you can look at what is selected in the above statement, see where the discrepancy is. You can calculate the Start and Count such that this statement will return the correct content.

    Looking at your code, nothing stands out as incorrect. Mainly, when I code for this scenario, I actually count elements in the list, rather than using FindIndex, but it seems to me that FindIndex would work just as well.

    My recommendation is to look at the results of the above query, and see why you are not getting the content you want to get.

    Let me know how I can help further…

    Cheers, Eric

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.