Placeholder is not shown after empty the SDT runs

Hi,
i’ve noticed this behaviour. I’ve a SDT with some text inside. After empty all the SDT runs i’ve expected that the sdt show the placeholder text but it doesn’t.
Any idea why?
here is my code.

Document doc = new Document("C:\\TestPlaceHoldertDocument.docx");
StructuredDocumentTag sdt = (StructuredDocumentTag)doc.getChild(NodeType.STRUCTURED_DOCUMENT_TAG, 0, true);

NodeCollection runs = sdt.getChildNodes(NodeType.RUN, true);
for (Run run: runs)
{
    run.setText("");
}
sdt.isShowingPlaceholderText(true);

doc.save("C:\\outputPlaceHolder.docx");

Hi Matteo,

Thanks for your inquiry. We have tested the scenario and noticed that Placeholder text is not appearing in resultant document. However, please note Placeholder text is not appearing in your source document as well, It seems your source document does not has Placeholder text.

Please share some details about your source document and requirement, so we will further look into the issue and will guide you accordingly.

Best Regards,

Hi tilal,

the scenario is this:
i write something in my sdt, then i remove the content and empty the runs and so i would like to see the placeholder in the sdt. It is how Word works.
My source document doesn’t have the placeholder visible, because i’ve write something in it, but if you debug my code and inspect sdt.getPlaceholder().getText() you will find “Choose a building block” text . So my sdt have the placeholder.

Thanks
best regards

Matteo

Hi Matteo,

Thanks for providing additional information. We have noticed the reported behavior with SDT, so logged a ticket WORDSNET-15220 in our issue tracking system for further investigation and rectification. We will keep you updated about the issue resolution progress within this forum thread.

We are sorry for the inconvenience.

Best Regards,

Hi Tilal,
can you tell me the ticket number, please?

Thanks
best regards

Matteo

Hi Matteo,

Thanks for your feedback. Please note ticket number for your above reported issue is WORDSNET-15220. I have also updated my above reply.

Best Regards,

@m4tte,

The issues you have found earlier (filed as WORDSNET-15220) have been fixed in this Aspose.Words for .NET 17.9 update and this Aspose.Words for Java 17.9 update.