Need to convert block level plain text sdt to inline level plain text sdt in word document

Hi Team,

I need to convert block level plain text sdt to inline level plain text sdt in word document. Can you please point me to the code. I need to maintain the formatting of the tag.

Please help.

@ashu_agrawal_sirionlabs_com There is no way to change level of SDT and this is not something that you can easily do. Inline SDT can be placed only as inline node, like Run, so you can have several inline SDT in the same paragraph. On other hand block level SDT can be placed on the same level as a paragraph.
You can try inserting inline level SDT at the position of block and then remove block, but this might lead into document layout change:

Document doc = new Document("C:\\Temp\\in.docx");
    
for (StructuredDocumentTag sdt : (Iterable<StructuredDocumentTag>)doc.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true))
{
    if (sdt.getLevel() == MarkupLevel.BLOCK)
    {
        StructuredDocumentTag inlineSdt = new StructuredDocumentTag(doc, sdt.getSdtType(), MarkupLevel.INLINE);
        inlineSdt.removeAllChildren();
                
        // Crete a paragraph and place it before original SDT
        Paragraph para = new Paragraph(doc);
        sdt.getParentNode().insertBefore(para, sdt);
        // Put SDT into the newly create paragraph.
        para.appendChild(inlineSdt);
                
        // Copy all content from block level SDT into newly create SDT.
        Node[] chilNodes = sdt.getChildNodes(NodeType.ANY, true).toArray();
        for(Node n : chilNodes)
        {
            // Only inline nodes can be inserted into the inline SDT.
            if(n instanceof Inline)
                inlineSdt.appendChild(n);
        }
                
        // Remove original SDT
        sdt.remove();
    }
}
    
doc.save("C:\\Temp\\out.docx");