The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Inserting Rich Text into PowerPoint

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Anand M

Posts: 984
Nickname: anandm
Registered: May, 2004

Anand M is a VB.NET MVP working as a Senior Architect @ Polaris Software Lab Ltd
Inserting Rich Text into PowerPoint Posted: Aug 22, 2008 7:28 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Anand M.
Original Post: Inserting Rich Text into PowerPoint
Feed Title: .NET From India
Feed URL: http://www.dotnetindia.com/index.rss
Feed Description: Your daily dose of .NET From India
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Anand M
Latest Posts From .NET From India

Advertisement

I was trying to programmatically insert some rich text into a specific text box in PowerPoint.

I had a rich text box in a winform application that had some formatted text. I wanted this to be moved into a specific textbox in my PPT.

The first approach I tried was to set the text directly:

txt.TextFrame.TextRange.Text=rtfbox.Rtf

 

But then the actual rich text markups were copied into the text. So the incoming data was getting interpreted as normal text. Makes sense..

So the next I tried was to copy the data from the richtext and then pasting it into the frame. When you do this manually, PowerPoint recognizes the format and pastes the data as formatted text.

Clipboard.SetText(rtfbox.Rtf)

txt.TextFrame.TextRange.PasteSpecial(PpPasteDataType.ppPasteRTF)

 

 

Now I started getting a strange error – "The specified value is out of range." - when the Paste command executes.

After some changing of options and a search that did not yield any results, I suddenly thought, maybe if I force the clipboard type to be RTF then it may work. Yep it did.

Clipboard.SetText(rtfPreview.Rtf, TextDataFormat.Rtf)

.TextFrame.TextRange.PasteSpecial(PpPasteDataType.ppPasteRTF)

 

Read: Inserting Rich Text into PowerPoint

Topic: The Future of .NET Reflector Previous Topic   Next Topic Topic: Execute sql within rails environment without using your models

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use