none
How do I add a space character to a Run or Text RRS feed

  • Question

  • I tried:

    Paragraph.AppendChild(new Run(new Text("Part 1")));
    Paragraph.AppendChild(new Run(new Text(" ")));
    Paragraph.AppendChild(new Run(new Text("Part 2")));

    and the blank space does not get included into the document.  The following, by putting a space in front of the string, also does not work.

    Paragraph.AppendCHild(new Run(new Text(" Part 2")));

    How do I add a blank space?

    Thanks.

    Monday, March 12, 2012 3:11 PM

Answers

  • You need to set the Text element's Space property to SpaceProcessingModeValues.Preserve:

    para.AppendChild(new Run(new Text {
        Text = " ",
        Space = SpaceProcessingModeValues.Preserve }));
    para.AppendChild(new Run(new Text {
        Text = " Spaces before and after ",
        Space = SpaceProcessingModeValues.Preserve }));
    

    Eric

    • Proposed as answer by EWoodruff Monday, March 12, 2012 4:25 PM
    • Marked as answer by K.Kong Monday, March 12, 2012 4:32 PM
    Monday, March 12, 2012 4:25 PM