Hosting Office in .NET applications


If you are building a .NET application and you are struggling to find a way to host Word documents, Excel spreadsheets, Visio drawings, Project files, or PowerPoint presentations, you might consider using the Visual C++ ActiveX Control for hosting Office documents. I learned about this download resource and I was shocked to see how you can add it to your solution and start working with Office applications in less than a minute. You can open Office applications, format content, update documents, save changes, print, and more inside your application. The Office Framer Control is an Active X control written in C++. The download includes source code to extend the functionality and sample code to use it inside Visual Basic 6 and HTML pages. You can also enable and disable specific functionality by using a full set of properties, methods, and events exposed for customization.


You can also host the control inside managed applications following these simple steps:



  1. Download and install the Office Framer Control 1.2 Sample.
  2. Start Visual Studio .NET. 
  3. Open your WinForms or WebForms application.
  4. Add the DSO Framer Control to the Toolbox: 

    • On the Tools menu, click Customize Toolbox (in Visual Studio .NET 2002), or click Add/Remove Toolbox Items (in Visual Studio .NET 2003), and then click the COM Components tab. 
    • On the COM Components tab, select DSO Framer Control Object. 
    • Click OK to close the Customize Toolbox dialog box.

  5. Select the DSO Framer Control icon that appears in the ToolBox and drag-and-drop the control over the Form or Web Form.
  6. Adjust the control’s docking/size as needed.
  7. Build and run the application.
  8. Create a new document to test the control.
I have to warn you that the control is not supported, the control and the source code is provided AS-IS for customization. However, you still can extend the functionality and it does the job, so have a peek and enjoy!


Comments (41)

  1. Rui Alves says:

    Hello Erika! I am writing to you from Portugal. I’m a Microsoft Application Developer and I own a small ISV company and I develop many applications that integrate with Office (especialy in VB6 and VBA). I have been a developer for .NET since the first versions ou VS.NET and now I am developing integration with Office using .NET instead of VB6. I have to say that I found your blog very usefull and this tool here (DSO Framer Control) is realy cool. I’m going to explore it a little bit more. Thanks!

    Rui Alves
    ruialves@edireizinho.pt

  2. Rui Alves says:

    Nice tool. I am going to check it out and explore it a little bit more.

    ruialves@edireizinho.pt

    PORTUGAL

  3. sam says:

    Hi

    Its really pretty good control. I want to use it in my application but when i included the project in my application its giving an error

  4. Stas says:

    Cyrillic symbols in menu shows incorrectly

  5. TJ Han says:

    I am porting an MFC application to .NET using C#.  The app has the feature of establishing OLE Link with Excel.  For example, user can copy a cell from Excel 2003 and do "Paste Link" to the app, and these 2 become linked together through OLE Link.

    I could not find anything on the internet do enable me to do that in C# and .NET.  Will this control help on this issue?

    Also I just heard about VS Tools for Office but have not tried it.  Does VSTO offer any help in this issue?

    Thank you in advance for any input.

    TJ

  6. brufus says:

    Hi,

    The control seems to work fine but i’m having trouble deploying it using one touch in vs2005.

    when i try to run the application on another machine i get the following error,

    System.InvalidCastException: No such interface supported at DSOFramer._FramerControl.get_ActiveDocument()

  7. shahab says:

    dear erika, hi great control, ot sure if i should post this here but having trouble opening a document on a remote server using URL,in write mode (oframe.open). document opens only if i say read only – i have check folder permissions etc. but no luck…the error msg says unspecified error on the open.. can you help?

  8. joseph says:

    I want to access the DSO Framer Control Object programetically ?

    if open/save form url should one open form

    specified folder

    and i want to disaply some menu option

  9. Love says:

    Is there similar control in the native .NET?

    Love.

    http://FrogFind.com

  10. Aseem says:

    can someone help me open a excel file through code using dsoFramer.

    Opening through file menu is perfect.

    but opening through code is giving me a lot of trouble.

    I am using Visual C++ 6. Enterprise Edition

    Hope to listen from someone 🙁

  11. Rajeev says:

    Is there a place where all the events and properties of DSOFramer are listed? Its turning out to be a major time taker while searching for them.

    Thanks.

  12. Luck says:

    readonly do not work ,please give me some help ,thank you!

    tjjhua@hotmail.com

  13. AbdulAleem says:

    Pls. can u tell me which versions of Internet Explorer support DSO Framer controls. And tell me which other browsers support it with which plug-ins. Pls. tell me am facing problem in opening

    DSO framer in my Internet Explorer. Pls. tell me clearly because i have clear this problem to my client also.

    My email : aleem_abdul@akebonosoft.com

    Aleem.

  14. abdul_aleem says:

    Pls. can u tell me which versions of Internet Explorer support DSO Framer controls. And tell me which other browsers support it with what plug-ins. Pls. tell me am facing problem in opening

    DSO framer in my browser. Pls. tell me clearly because i have to clear this problem to my client also.

    My email : aleem_abdul@akebonosoft.com

    Aleem.

  15. jimmy george says:

    I canot import the dso framer control to Visual studio 2005 tool box??can you plz help me in tht??

  16. Peter says:

    You can install it in the 2005 toolbox. Pretty tricky though. Furthermore… is you do a lot of calls I get timing issues with the Excel COM. I haven’t found a way to time the threads yet.

  17. Pachara says:

    Hello

    I can’t set summary property (Keywords).

    Help me please

  18. Ruben Castelo says:

    Hi ! im using the DSO but i want to set the zoom of the document by code .. and some others propertys, can anybodi help me ?

    Tnx !

    rcasstelo@hotmail.com

  19. Abdul says:

    Hi! ALL

          The site is grt. Can anyone direct me how  to host complete visio in the .net managed application using dsoframer ? I have used visio drawing control. I want visio in my application like the one shown in the pic in this page

  20. Evgeny says:

    I suppose it’s absolutley awful!

    Why microsoft don’t want to create a good implementation of the office viewers which can be easily embedded into Windows Forms and WPF.

    Such controls are microsoft undone work. I’ve also used such tricks as putting the WebBrowser control into the form then opening a localy store .ppt file. It seems to me as an awful solution… but it’s the only worked.

    You should better create a better Office Control for .NET applications.

  21. Confused_One says:

    Will you marry me.  Thanks…just what I needed!!!

  22. dsoframer says:

    Every time I call the print preview, the ms office crashed when exit the print preview. I am using the Office 2003. It’s very strange thing. I have update all the office package. But it look like no help. Any suggests are welcome.

  23. Bhaskar says:

    I want to add commandbars to DSoframer control(i mean after opening a word document only)and add items dynamically to the commandbar control dropdownlist.

    I am customizing the source code for my purpose. Please advice me  is this possible?

  24. Miguel says:

    I can’t add dso framer to the vs2005 toolbox could you help me please???

  25. Robert says:

    Hi, many people are asking about adding DSO framer into VS2005 toolbox. Does anyone have a reply for this, as I have not managed either.  When adding the DSO framer to the toolbox (VS2005) the control appears disabled, and I am not able to use it. Any ideas?  The same thing happens when adding the Visio Drawing Control to the toolbox in VS2005

  26. Michael says:

    Open your VB.NET or C#.NET 2005 project.

    Click on the Tools pull-down menu and the Choose Toolbox Items option.

    Click on the COM Components tab.

    Scroll down in the Listbox to find "DSO Framer Control Object" and click on its Checkbox.

    If it’s not in the list, click the "Browse" button and navigate to wherever dsoframer.ocx is loaded on your machine (on my system it’s at: c:DsoFramerdsoframer.ocx).

    Click OK.

    Look for it in the "General" section of the Toolbox.

  27. Jacky says:

    I developed an application with VB 2005. I’m using dsoframer control in the application to host MS Word document.

    I have no problem to load the word doc inside the dsoframer. But the problem is every time i click on the Print Preview button to preview the document and then close the print preview screen, the loaded

    document become a blank document inside dsoframer. In other word, the content on the document is gone! Then i tried to click on the Print preview button again, i

    found out that the content is still there under the preview mode. But i wonder why when i clicked on the close print preview, the content of the document is gone??

    Can anybody tells me why and how to fix this? Thanks in advanced…

  28. zachary says:

    I have tried to download the control from the page listed above (http://support.microsoft.com/default.aspx?scid=kb;en-us;311765) but I get an error when i try to run the exe.  The error message states the file is not a valid win32 application.  Is there another download place?  Is anyone else having this problem??

    Thank you,

    zh

  29. zachary says:

    Well, i got the sucker to work…somehow.  Musta been the gremlins…or possibly the aliens

  30. Heinrich Braasch says:

    Got this control to work relatively well using VB.NET after starting to play with the FramehookPolicy and ActivationPolicy properties. Stil another problem remains… when loading MsProject and opening the "Task Information" dialog, it appears it does not recieve some of the messages (e.g. cannot change fields in it). Anybody out there with some suggestions? Shall be much appreciated. Regards.

  31. gust says:

    hi,i have tried the method ,and it’s cool . but can you tell me how to get a reference of the  document/worksheet  that the cotrol opened? i want to change something through code,so it’s important to me.

  32. Ana Silva says:

    Good afternoon.

    I was trying to open a word document programaticaly on my page load event of the webform.

    Like this:

    objWordDoc = New DSOFramer.FramerControl

    objWordDoc.EventsEnabled = True

    objWordDoc.ModalState = False

    objWordDoc.Open("WORD_URL_PATH", True)

    But it despalys an error.

    Can anyone tell me if I’m doing anything wrong?

    Best regards,

    Ana Silva.

  33. NK says:

    Has anyone tried using this control in an ASP .Net application? The DSO Framer Control in the toolbox appears greyed out for ASP .Net apps, but is available for Windows Apps.

  34. LandroHun says:

    Hi, I’m also involved in asp.net version. Could anyone share some source code?

  35. Haneef says:

    Hi All,

    Can any one help me or provide me a sample code. How to save a word document on web server through DSOFramer.ocx

    I will appreciate if the code in c#

    Very Best Regards,

  36. Aniruddha says:

    Hello,

    Its really nice tool,but i would like to open XML file but it is giving me error.

    what i need to do to open XML files and office 2007 files.

  37. Niluka Subasinghe says:

    Hi,

    I’m not very much familiar with vc++. I worked with this control. I want to extend the functionality of this control. I want to restrict the user to copy and paste the document when it is necessary.

    How can i do this? Please help.

    Regards,

    Niluka

  38. Txarly says:

    How can i download the control? the url do not work fine.

  39. RK says:

    Thank you. I have one problem. I used Dsoframer.ocx . But i have error or warning "Unable to display inactive document click here to reactive object" . Now to solve.

    Thanks for reply.

  40. Paul Moura says:

    I have found this to be an amazing tool. It is working quite well for what I need. However, when I close an xlsm file from the code-behind, I get an error when trying to reopen the document.

    Any feedback would be highly appreciated.

    Email: paul.moura@sgs.com