Read data between 2 string using Aspose word c#

Hi,

I want read data between 2 string of word document using c#

Please find attached screenshot
For eg: i need data between below 2 strings
a) “COMPANY PROFILE & PROFILE SUMMARY :” and "NON-COOPERATION WITH PREVIOUS RATING AGENCY: "
b) "NON-COOPERATION WITH PREVIOUS RATING AGENCY: and "RATING HISTORY :
c) "RATING HISTORY : and "ANNEXURE: "

How can i achieve?

@pravinghadge You can achieve this using the approach suggested in the following article:
https://docs.aspose.com/words/net/how-to-extract-selected-content-between-nodes-in-a-document/

But as I can see in your document the content that should be extracted is represented by structured document tag. So you can simply get the SDT and extract it’s content.

Thank you Alexey for your reply

We have removed SDT from documents.

Is there any other way to get data between 2 strings

@pravinghadge Yes, you can use the approach suggested here:
https://docs.aspose.com/words/net/how-to-extract-selected-content-between-nodes-in-a-document/

first you should detect the start and end paragraphs and then extract content between these paragraphs. For example you can check whether paragraph starts with a particular string:

bool paraStartsWith = para.ToString(SaveFormat.Text).Trim().StartsWith("Some String");