Tab characters in OpenXML

Viewed 7309

I'm using OpenXML to add text to a pargraph node. I am wrapping OpenXML methods, and have the following method to append text, which works fine with text without markup.

    public void AddPlainParagraphText(string text)
    {
        m_wordprocessingDocument.MainDocumentPart.Document.Body.AppendChild(
            new Paragraph(
                new Run(
                    new Text(text))));
    }

I know that for special characters such as tabs, you need to use OpenXML's TabChar class and append that to the Text item. I'm trying to figure out if I can have this automated, where OpenXML would see the '\t' in the text, and automatically set the XML up to support the tab via . I suppose I could tokenize the string by \t, but then I'd have to search for every type of markup character. Can this be done automatically?

1 Answers
Related