Cannot insert to this type of location issue when append run to StructuredDocumentTag

Hi,

When I tried to use aspose word to convert docx to html, I got this problem. This issue just happened when i add a tag to the beginning of line. For example,

@(structuredTag) => will be error. However, when i just added one space before this tag, it worked fine. For example:
" "@(structuredTag) => will be fine.
Below is my code:
private void CustomSdtTag(Document doc)
{
var tags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);
foreach (var tag in tags)
{
var sdt = tag as StructuredDocumentTag;
if (sdt == null || sdt.SdtType != SdtType.RichText)
{
continue;
}
sdt.RemoveAllChildren();
sdt.AppendChild(new Run(doc, sdt.Tag)); => issue went from here
}
}

Please help me to resolve this issue.
Many thanks,
Hi Thanh,

Thanks for your inquiry. Could you please attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

Thanks for your concern,

I had found out solution for this by myself :slight_smile:
Many thanks,
Thanh.
Hi Thanh,

Thanks for your feedback. It is nice to hear from you that you have solved your problem. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.