DocumentBuilder.InsertHtml with tab character doesn't work

Hello, I’m trying to use the DocumentBuilder.InsertHtml method but it doesn’t diplay the tab character as expected. I’ve tried multiple ways of defining the tab character but nothing works.

var builder = new DocumentBuilder();
builder.InsertHtml("	");
builder.InsertHtml("	");
builder.InsertHtml(ControlChar.Tab);
builder.InsertHtml("\t");

@gojanpaolo

Please use DocumentBuilder.Write method instead of DocumentBuilder.InsertHtml to get the desired output.

@tahir.manzoor

I need to use the InsertHtml because:

builder.InsertHtml("my <b>actual</b> <i>input</i> is an html with a \t tab in it");

@gojanpaolo

We have logged a feature request as WORDSNET-18514 in our issue tracking system to export \t as Tab when it is used via InsertHtml. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@tahir.manzoor Could you please provide a link of the issue tracking system? I can’t find it anywhere. Thanks!

@gojanpaolo

Please note that our issue tracking system is not public. So, you cannot access it. However, you can ask for update in this forum thread and we will share the update of this issue with you.

@gojanpaolo

It is to inform you that we have closed the issue (WORDSNET-18514) with “Won’t Fix” resolution.

You could use some arbitrary non-whitespace character to represent tabs in HTML and then replace occurences of this character with tabs after HTML has been inserted. Please check the following code example. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// U+FFFD is used as a placeholder for tab characters in HTML.
builder.InsertHtml("my <b>actual</b> <i>input</i> is an html with a &#xFFFD; tab in it");
builder.Document.Range.Replace("\uFFFD", "\t", new FindReplaceOptions());
doc.Save(MyDir + "out.docx");