How to preserve whitespace with OpenXML? RRS feed

  • Question

  • Hi All,

    I found the openxml sdk has no attribute/method to preserve whitespace. I build a very simple test PPT following the steps bellow.

    1.     Create an empty PPT.

    2.     Input character ‘11111  22222’.

    3.     Set character ‘11111’ to red, and set character ‘22222’ to blue.

    4.     Save the PPT AS test.pptx.


    Then I use the following code to test it.

    PresentationDocument doc = PresentationDocument.Open(@"D:\temp.pptx", true);
    PresentationPart part = doc.PresentationPart;

    The ‘part’ object which contains slide content, it’s inner xml will be no space.


    I want to know how to preserve whitespace when open ppt with openxml sdk?

    Thursday, September 30, 2010 10:08 AM