.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > Embedding Office Content in WPF Control
 

Embedding Office Content in WPF Control

Would like to know how to embed a Microsoft Office document within a WPF control so that if Office is present on the runtime system the document can be edited and if it isn't it can be viewed, but not edited (I assume this is possible since OLE objects work this way).

Would also like the display to be embedded within the control so that it resizes and repositions properly within the application, including scrollbar support.

Can anyone help with this? Thank you.
Tom Jorgenson
  • Moved byTaylorMichaelLMVPTuesday, September 22, 2009 1:05 AMWPF related (From:Visual C# General)
  •  
ETJorg

If I understand correctly, it seems you are storing the Office document in database as blob data like the following KB does,
http://support.microsoft.com/default.aspx?scid=kb;en-us;326502, right?

Unfortunately, there is no wayin DsoFramer, WebBrowser, even or Office object model to load a document directly from a stream or byte array. That is to say,currently,the onlyapproach to display Officecontent is from local file.

Ji Zhou

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg@microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Marked As Answer byETJorg Thursday, September 24, 2009 12:39 PM
  •  
Ji.Zhou

Hello Tom,

There are some host controls can contain the Office content,

1. .NET WebBrowser(We need to place a winform host on the WPF application and use the winform host to contain an WebBrowser and then we can use WebBrowser's Navigate function to open an Office document)


2.DsoFramer. This is an ActiveX control,there are some code smaples in WPF SDK that demostrate how to host an ActiveX control inside the WPF application

http://msdn2.microsoft.com/en-us/library/ms742735.aspx


Dr. WPF has blogged this on this topic with sample codes for downloading,
http://drwpf.com/blog/Home/tabid/36/EntryID/3/Default.aspx

Have a nice day!

Ji Zhou

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg@microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Ji.Zhou
Thank you for that reply. But would also like to store the content in a database and display it when requested, ideally without writing it to a file first and then loading the file.

Do you know of a way to do this?

Tom Jorgenson
ETJorg

If I understand correctly, it seems you are storing the Office document in database as blob data like the following KB does,
http://support.microsoft.com/default.aspx?scid=kb;en-us;326502, right?

Unfortunately, there is no wayin DsoFramer, WebBrowser, even or Office object model to load a document directly from a stream or byte array. That is to say,currently,the onlyapproach to display Officecontent is from local file.

Ji Zhou

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg@microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Marked As Answer byETJorg Thursday, September 24, 2009 12:39 PM
  •  
Ji.Zhou
Thank you. That's just what I needed to know.
Tom Jorgenson
ETJorg

You can use google to search for other answers

Custom Search

More Threads

• Create String onbject contains whitespace (" ") in XAML
• Designer for UserControl
• Wrong placement with adorners and scrollviewer.
• Animated Tab Control???
• Using Arrow Keys Does Not Raise Key Events in ComboBox
• Easier way to insert a block element at the current caret position? (RichText)
• ValidateEditText
• Data Binding Issue
• Editing the visual tree
• Binding to object w/in an array of parent object