0

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 ?

H H
  • 263,252
  • 30
  • 330
  • 514
Krrish
  • 135
  • 15
  • 2
    What is export PPT means here? Are u creating PPT (MS Office) through c# without interops? – Pratik May 09 '12 at 11:55
  • 1
    Hard to understand. HTML encoding in a PowerPoint? – H H May 09 '12 at 12:22
  • Sorry for the confusion. I've a master powerpoint file, I am opening that file into C# and adding images , text into that and writing using MemoryStream on the memory for user. Now when I am adding such text, so the text is being append in the same html tag format. – Krrish May 09 '12 at 12:24
  • if I've Bold can it look in ppt as **Bold** – Krrish May 09 '12 at 12:27

1 Answers1

1

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);

Community
  • 1
  • 1
Joshua Drake
  • 2,704
  • 3
  • 35
  • 54