navinag
navinag

Reputation: 41

Formatting lost while pasting content in PowerPoint using VSTO

I have xhtml content saved in SQL database, I want to insert this xhtml content in PowerPoint presentation, so I copy the xhtml content to clipboard, and then try to paste it in Powerpoint. It works fine for normal text with bullets, bold, italics. But with tables when I paste, the formatting is lost and it copies it as normal text.

I put a break point before pasting it through code, and tried to manually paste the content (ctrl+v), then it works fine, the table gets pasted as it should be.

I am using Office 2010 and VSTO.

The xhtml content comes from InfoPath Form, with RTF field, so it stores data in XHTML form.

When submitting, the data goes to a webservice that inserts data in SQL.

Now, I need to insert this XHTML in PPT.

I use http://www.tcx.be/blog/2005/copy-html-to-clipboard/ to copy html to clipboard. I have tried both paste and pastespecial with html type, but when pasting tables the formatting is lost.

Upvotes: 4

Views: 1117

Answers (1)

Fabio
Fabio

Reputation: 990

Try to save the file html to the file system and add it as OLE object:

presentation.Slides.addOLE

If I remember well you have to set some option adding the ole to display the content instead of the icon (default behavior).

Upvotes: 1

Related Questions