How to extract headings (not headers) in word document

Can anyone suggest me how to extract Headings (Not headers) in word document with the help of Uipath activities or VB script?

Hi @Rohit_Patil1 ,

Does the Word file contain the Table of Contents ? If it does, Are those the Headings you would require to be extracted ?

Hi, Thank you for replying.
Yes, like we have different topic headings on different pages in word document. I want to extract those headings(Contents)
For Ex. on page 1, I have Introduction, Overview
on page 2 I have Purpose , on page 3 I have Design and so on.

Here is one suggestion from Stackoverflow:

@Rohit_Patil1 ,

Check the Workflow Below :
Word_Extract_Headings.zip (14.3 KB)

Here we use OpenXml to Identify the Heading values.

Let us know if it doesn’t work.

Hi, it’s worked for your document. but when I do it with my word document, it is showing like

Source: Message Box

Message: Value cannot be null.
Parameter name: value

Exception Type: System.ArgumentNullException

RemoteException wrapping System.ArgumentNullException: Value cannot be null.

Thank You. I will go through it.

@Rohit_Patil1 ,

Could you provide a Sample file of your document ?

I can’t share it with you as per new member policy

Share a screenshot of the header portion

Ok…So here which are the values that you want to extract? and will it be a standard layout always?

Actually I want to set bookmark for each heading like Purpose, Security, Vision etc.
So I want to extract those headings and pass them in set Bookmark Content activity

I believe with the current activities we can Set the content in the Word using the bookmark and not able to retrieve the value.

Plz refer the below post.

Okay Rahul. Thanks for Information