When adding a StructuredDocumentTag of SdtType.PlainText or the content control in word is not editable. It makes me overwrite the content in the control, not edit or append to it.
I have uploaded a sample project to:
https://1drv.ms/u/s!akckc0juitke2gfasrguu4njifjv
Thanks
I should add… once in word and the text is overwritten for the first time, the text is editable.
@robschenkel,
You can fix this issue by specifying false to StructuredDocumentTag.IsShowingPlaceholderText property as follows:
...
...
}
case 4:
{
var structuredDocumentTag = new StructuredDocumentTag(document, SdtType.PlainText, MarkupLevel.Inline);
structuredDocumentTag.RemoveAllChildren();
structuredDocumentTag.IsShowingPlaceholderText = false;
structuredDocumentTag.AppendChild(new Run(document, "This is the text for 4"));
builder.InsertNode(structuredDocumentTag);
break;
}
case 5:
{
...
...
Hope, this helps.
Best regards,
@awais.hafeez thanks so much.
Unrelated question… I saw somewhere that there was a sample that printed out the structure of a document. Would you know where this is? i.e. it allowed you to click on each run and see the content, etc.
@robschenkel,
Please refer to the following article and sample:
Document Tree Navigation
Document Explorer GitHub Example
Hope, this helps.
Best regards,