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

Free Support Forum - aspose.com

How to count Content Control SDT using .NET

Trying to find number of place holder in document

Samplep doc : normal word and having one place holder (placeholder) in document
output : expected to print list of placeholder in cosole application


Unfortunately, we have not found any attachment with your post. Please ZIP and attach your input and expected output here for our reference? We will then provide you more information about your query along with code example.

Placeholder.zip (19.2 KB)
Samplep doc : A document having list of placeholder like testplaceholder1 , testlaceholder2, testplaceholder3
output : expected result is - To print list of placeholder in cosole application


Your document contains content controls. The StructuredDocumentTag represents a structured document tag (SDT or content control) in a document. Please read the following article about working with content controls.
Working with Content Control SDT

Following code example shows how to iterate over content controls of document. Hope this helps you

Document doc = new Document(MyDir + "Placeholder.docx");
foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))

No its not even entering into for loop Please check attchement for sample code need a solution how to know placeholders in document .Placeholder.zip (20.0 KB)


We have not found this issue with your document while using the latest version of Aspose.Words for .NET 20.5. So, please use Aspose.Words for .NET 20.5.