We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

C# Read data of Structured Document Tag

I am trying to read data of structured document tag. but not able to get data
My Code:

Document doc = new Document(fname);
DocumentBuilder builder = new DocumentBuilder(doc);

foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
    if (sdt.Tag == "Current Rating" || sdt.Tag.ToString().Equals("Current Rating"))
        //obj.CompanyProfile = sb;

In above code, i am trying to get data of current rating but not able to get

Please find attached test document.
Structured tag.zip (84.3 KB)

Can you please help me where i am doing wrong

@pravinghadge I have checked your document and as I can see there is no data in SDT with "Current Rating" tag. Please see the following SDT representation:

			<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
			<w:sz w:val="20"/>
			<w:szCs w:val="20"/>
		<w:alias w:val="Current Rating"/>
		<w:tag w:val="Current Rating"/>
		<w:id w:val="1009029961"/>
		<w:lock w:val="sdtLocked"/>
			<w:docPart w:val="2A1A382A8B8C4666A71E767B86E8A4A5"/>
		<w15:color w:val="FFFFFF"/>
		<w15:appearance w15:val="hidden"/>

As you can see <w:sdtContent/> is empty. Could you please let us know what is the expected data you would like to get?

Thanks for your reply

I want to read data between 2 SDT tags

Can you please suggest code

@pravinghadge Thank you for additional information. If you would like to extract content between two StructuredDocumentTag nodes you can use the technique described in this article.
If you need to extract content of StructuredDocumentTag node itself, you can simply get it’s child nodes. But as I mentioned SDT with "Current Rating" tag in your sample document is empty.