Ask a questionAsk a question
 

AnswerWord OCX Control

  • Monday, January 23, 2006 12:06 PMFourge Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am trying to create a Windows Forms application that encapsulates the Word OCX on/inside the form.  Is this possible, and how would I go about it?

    Thanks

Answers

  • Monday, January 23, 2006 4:47 PMGeoff Darst - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

    This isn't really the right forum for this post; only questions related to Visual Studio Tools for Applications will likely get an answer here.  You will want to post this question over in the Windows Forms forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=8&SiteID=1

    The short answer to your question is that this is possible, but you will have to use COM interop to host word as either an in place object or a document object via the respective OLE technologies.  It is perfectly possible, but it will be a fair amount of work (there are a lot of interfaces that must be implemented).  It may be that there is a sample available to demonstrate this (someone in the Windows Forms Forum will probably know). 

    Sincerely,

    Geoff Darst

    Microsoft VSTO Team

  • Monday, January 23, 2006 4:54 PMJohn R. Durant - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Fourge,

    I am not sure which Word OCX to which you are referring, but I am guessing that you are talking about hosting Word visually within a WinForm application. Not infrequently does this scenario appear in forums and newsgroups.

    Hosting Office 2003 (or earlier) applications in this way is not supported. You end up having to use the SetParent API, and this can lead to unpredictable results. We used to have a thing called oFramer that did this, and it was not reliable, so it's unsupported and not available anymore.

    If you are thinking of using the DSOFramer control (also a somewhat common idea), I am not sure that this is supported in a .NET application. Also, I have heard that perf is an issue.

    OK-so what other option is there? How about using the Web Browser control which will in turn nav to a Word doc (or Excel, PPT, etc.)?

    You can use the WebBrowser control, and there is a KB on how to do it:

    http://support.microsoft.com/default.aspx?scid=KB;en-us;304662

    However, I strongly recommend you note the issues explained at the end of the KB. There are special considerations that you need to keep in mind as you go down this road.

    HTH!

    John.

     

  • Wednesday, May 21, 2008 2:17 PMGeoff Darst - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    The answer is still the same:

     

    This question is off-topic and unrelated to VSTO.  It is possible.  You must create an InPlaceActivation container yourself, and doing that is difficult and requires a great deal of COM expertise.  Or you can try to use the Web Browser as mentioned previously in the thread--though the Web Browser is an imperfect container so you may no like the results.

     

    Sincerely,

     

    Geoff Darst

    MIcrosoft VSTO Team

     

All Replies

  • Monday, January 23, 2006 4:47 PMGeoff Darst - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

    This isn't really the right forum for this post; only questions related to Visual Studio Tools for Applications will likely get an answer here.  You will want to post this question over in the Windows Forms forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=8&SiteID=1

    The short answer to your question is that this is possible, but you will have to use COM interop to host word as either an in place object or a document object via the respective OLE technologies.  It is perfectly possible, but it will be a fair amount of work (there are a lot of interfaces that must be implemented).  It may be that there is a sample available to demonstrate this (someone in the Windows Forms Forum will probably know). 

    Sincerely,

    Geoff Darst

    Microsoft VSTO Team

  • Monday, January 23, 2006 4:54 PMJohn R. Durant - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Fourge,

    I am not sure which Word OCX to which you are referring, but I am guessing that you are talking about hosting Word visually within a WinForm application. Not infrequently does this scenario appear in forums and newsgroups.

    Hosting Office 2003 (or earlier) applications in this way is not supported. You end up having to use the SetParent API, and this can lead to unpredictable results. We used to have a thing called oFramer that did this, and it was not reliable, so it's unsupported and not available anymore.

    If you are thinking of using the DSOFramer control (also a somewhat common idea), I am not sure that this is supported in a .NET application. Also, I have heard that perf is an issue.

    OK-so what other option is there? How about using the Web Browser control which will in turn nav to a Word doc (or Excel, PPT, etc.)?

    You can use the WebBrowser control, and there is a KB on how to do it:

    http://support.microsoft.com/default.aspx?scid=KB;en-us;304662

    However, I strongly recommend you note the issues explained at the end of the KB. There are special considerations that you need to keep in mind as you go down this road.

    HTH!

    John.

     

  • Monday, February 06, 2006 9:10 AMAk Reddy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

       I have a requirement to show a word document on a web form and the user can change the document and the changes should be saved to web server.

    For this purpose i am using DSO Framer control available at

    http://support.microsoft.com/default.aspx?scid=kb;en-us;311765

    But while saving the document to web server i am getting following error

    "The process Can not access the file because it is being used by another process".

    Even the VB6 sample which we get after installing the control also getting the same error while saving the document to web server.

    How can I solve this?

    Any help would be greatly appreciated.

    Regards,

    Anil Kumar Reddy.

    akreddy_mca@hotmail.com

     

  • Wednesday, May 21, 2008 1:43 PMKishan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello,

     

    Its quite an old issue... but still the problem didnt get solved in the new version also. Has any perfect solution for this issue?

     

    Thanks,

     

    Kishan Hathiwala

  • Wednesday, May 21, 2008 2:17 PMGeoff Darst - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    The answer is still the same:

     

    This question is off-topic and unrelated to VSTO.  It is possible.  You must create an InPlaceActivation container yourself, and doing that is difficult and requires a great deal of COM expertise.  Or you can try to use the Web Browser as mentioned previously in the thread--though the Web Browser is an imperfect container so you may no like the results.

     

    Sincerely,

     

    Geoff Darst

    MIcrosoft VSTO Team

     

  • Wednesday, May 21, 2008 2:45 PMKishan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    Thanks for replying. Yes I read that in your reply that its an off topic but since it was further discussed and also this thread was open for further discussion I continued to this topic.

     

    Since this control has an error regarding this, then why do they provide an option for saving on web?

     

    Regards,

    Kishan Hathiwala

     

  • Wednesday, May 21, 2008 3:23 PMGeoff Darst - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    We don't generally close threads to discussion (and I'm not sure that would be a good idea anyway) so we just have to rely on everyone to voluntarily respect the forum and keep their posts pertinent.  Mostly this is in the interest of the poster.  Off-topic questions are much less likely to get answered because they don't align with the interest or expertise of the people who frequent this forum.  We want people posting in the right places because we want them to get help (rather than being frustrated by lack of responses).  We also want to minimize the work for our contributors.  If people have to wade through lots of off-topic questions before they get to questions that they find interesting, they will be less likely to participate--which again means you are less likely to get an answer.

     

    From your post it is unclear what control you are talking about, but assuming your question relates to the WebBrowser control, the Windows Forms forum will likely be a much better place to get your question answered:  http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=8&SiteID=1.  If you are asking about the DsoFramer, you could try to post to the Visual C++ newsgroup: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.languages.vc&cat=en_US_e0896eea-b99a-41a4-8d11-9ee01d5c3b3d&lang=en&cr=US.  The Visual C++ forum probably won't take the question because DsoFramer is a legacy sample. 

     

    Also, since the DsoFramer is a sample, you should have the source code.  You might have better luck doing some debugging and possibly reframing your question based on the results.  A DsoFramer question is probably less likely to be answered than a more generic question about file sharing, for example.  Once you've narrowed down the problem you might find that it makes sense to post to a different newsgroup such as Win32 or Ole development.

     

    Sincerely,

     

    Geoff Darst

    Microsoft VSTO Team

     

     

  • Thursday, May 22, 2008 1:56 PMKishan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    Am sorry for the aggressive answer/comment. but thanks anyways.

     

    Regards,

    Kishan