HTML String Encoding

773 Views Asked by At

I've a requirement to export ppt from C# without using introp dlls. I am able to do that but when I do append some HTML string i.e. "<b>Krishna</b><br/><strong>Ram</strong>" in any slide, it is showing the same text, not rendered one. Can any help me ?

1

There are 1 best solutions below

0
On

It appears that PPT does not currently support HTML rendering directly in PPT. You must either export your slide show as HTML, or use the built in formatting as shown in answer to the following question: Apply Font Formatting to PowerPoint Text Programatically.

Set tr = ActiveWindow.Selection.SlideRange.Shapes(1).TextFrame.TextRange
        With tr
            .Text = "Hi There Buddy!"
            .Words(1).Font.Bold = msoTrue

For an idea of the settings in C# and Office 2010 specifically see Font Members.

You should be able to test my assertion yourself, by HTML encoding your text using the HttpServerUtility.HtmlEncode Method:

String TestString = "This is a <Test String>.";

String EncodedString = Server.HtmlEncode(TestString);