none
Trackable identifier of Paragraph between InterOp and OOXML? RRS feed

  • Question

  • Hi, all.

    I have a development requirement to connect both of following 2 items from same original document:

    1) w:p element via OOXML(Document.WordOpenXML property)

    2) Paragraph object via InterOp(.NET F/W, or VBA)

    So far, I've just imagined that managed Paragraph.ID will work fine for the requirement.

    However unfortunately, the Paragraph.ID isn't persistent and isn't serialized to OOXML...

    Could you please suggest any other workarounds for the situation? Thank you.

    Friday, July 27, 2018 4:44 AM

All replies

  • Hello sadap,

    I would suggest you try to use Paragraph.ParaID property in InterOp. Its corresponding property in OOXML is Paragraph.ParagraphId property(w14:paraId). 

    Please note Paragraph.ParaID is a Decimal system number and Paragraph.ParagraphId is a Hexadecimal number string. You need convert them before comparing.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, July 30, 2018 2:05 AM
  • Unfortunately, Terry, this property is "for internal use" and is not reliable for use with the Interop...

    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    Monday, July 30, 2018 4:26 PM
    Moderator
  • There is no direct way to reliably "map" a paragraph in the Word Open XML document to a paragraph in ther interop.

    IF the document contains only text content the ordinal number (1st paragraph, 2nd paragraph... last paragraph) should work. Both the XML and Word object models should support returning a paragraph based on its position in a document Story (main body, header, footer, etc.)

    Otherwise: Is it necessary to be able to identfiy every paragraph in a document, or only certain ones?


    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    Monday, July 30, 2018 4:29 PM
    Moderator