|
You'll need to use Office Interop in your server side code.
only two letters away from being an asset
|
|
|
|
|
i am getting following error
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Please help me out
Hemant
By:
Hemant Thaker
|
|
|
|
|
Have you verified all the assemblies are in place and are the correct versions?
only two letters away from being an asset
|
|
|
|
|
And you need the office app installed as well don't you? I mean the assemblies are dependent on the actual COM interfaces right?
|
|
|
|
|
Hi...thanks for your support
See this is my code..
///////////////////
using Microsoft.Office.Interop.Word ;
ApplicationClass oWordApp = new ApplicationClass();
object fileName = "c:\\myfile.doc";
object missing = System.Reflection.Missing.Value;
Document oWordDoc = oWordApp.Documents.Add(ref missing,
ref missing, ref missing, ref missing);
oWordDoc.Activate();
oWordApp.Selection.TypeText("This is the text");
oWordApp.Selection.TypeParagraph();
oWordDoc.SaveAs(ref fileName, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
oWordApp.Application.Quit(ref missing, ref missing, ref missing);
/////////////////////////////////
I am using MS Word 2003, I have added reference of COM --> Microsoft word object library 11.0
Please tell me if i go wrong with this code..
thanks
Hemant
By:
Hemant Thaker
|
|
|
|
|
As led mike has said, Word should be available on the system you are trying to run this code on
only two letters away from being an asset
|
|
|
|
|
Your code worked fine for me without modification. I added your code to an existing project in Visual Studio 2008. I added a COM reference to the Microsoft Word 11.0 Object Library and kept your using directive for the Microsoft.Office.Interop.Word namepsace. I then placed your code into the CreateWordDoc() method, within the WordDoc class. When I then called the method, It created the Word file without any error.
using Microsoft.Office.Interop.Word;
public class WordDoc
{
public void CreateWordDoc()
{
ApplicationClass oWordApp = new ApplicationClass();
object fileName = "c:\\myfile.doc";
object missing = System.Reflection.Missing.Value;
Document oWordDoc = oWordApp.Documents.Add(ref missing,
ref missing, ref missing, ref missing);
oWordDoc.Activate();
oWordApp.Selection.TypeText("This is the text");
oWordApp.Selection.TypeParagraph();
oWordDoc.SaveAs(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
oWordApp.Application.Quit(ref missing, ref missing, ref missing);
}
}
Regards,
Gary
modified on Sunday, June 21, 2009 2:45 PM
|
|
|
|
|
Sir...
thanks for ur cooperation but i am still getting this error if i run it in vs 2008
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
please guide me for this
thanks
Hemant
By:
Hemant Thaker
|
|
|
|
|
Hi..
Now i know how to create word document.
What i need to know is, how to create Header in particular word document and save it.
Please help me out of this
thanks
Hemant
By:
Hemant Thaker
|
|
|
|
|
|
Hi....
thank you very much... this worked fine...
Hemant
By:
Hemant Thaker
|
|
|
|
|
hi,
how to get the data of particular website (eg:www.orkut.com) by giving credentials such as Login username and password of the above site and get all those data to our website.
I mean how to get the other sites data to our site. I wanted to download the content of the other website(eg:orkut.com) to our website by giving credentials of other website from our website...
Can any one help me out in this............
Regards,
Ravi
|
|
|
|
|
|
How to use Jquery validation plugin in ajax update panel?
|
|
|
|
|
Hello.
I know many websites already discuss this, but I have yet to find a code that actually works correctly on our site. I would like a Facebook Icon, Twitter Icon, and LinkedIN Icon (NO text), that allows a user to click on either one of the three icons/widgets which allows users to Share our website on the widget they chose. I do not want to add the infamous "Add This Button" I want only those three widgets. Any advice/direction/coding will be accepted. Thank you.
|
|
|
|
|
|
|
|
Yes, very helpful, but I hope you do realize that the question spans many fields, and expert in any of them could have the answer.
|
|
|
|
|
the_jat wrote: Yes, very helpful
Yes it is very helpful to the other people on this site that freely give there time to help those asking for help. When you cross post someone that freely gives there time might be wasting it answering you in one forum when an entire conversation with you is going on in another forum. It is rude and inconsiderate of you to do that, period, end of story.
Now if you are feeling froggy and want to insult me again, JUMP.
|
|
|
|
|
led mike wrote: might be wasting it answering you in one forum when an entire conversation with you is going on in another forum
First not every question demands a length conversation, and this is one of them. and this tiny little thing didn't got through your brain. How could it have been when you were jumping around forums just to see what went wrong.
Also, If some one cross-posts he/she should take responsibility for managing all conversations, you probably wouldn't have done that, but again not everyone is stupid like you. also I don't believe people cannot manage conversations with 4-5 individuals at the same time. and if the issues has been resolved in one of the posts, the one who started can politely thank those who participated and notify them about the status. Thats how it could work.
led mike wrote: freely gives there time
You cared to give a 1-rating to all the posts and reply with a stupid message. It seems you did jump like a frog, Now, everyone knows how you use your time, you undoubtedly are dumb.
led mike wrote: period, end of story
Put one on your mouth and one on yourself. That would help you
led mike wrote: JUMP.
you are good at it, so you do it, i'll just watch.
|
|
|
|
|
|
Hi guys,
I've been asked to look at updating an ActiveX control but it's pretty nasty and I'm wondering if these days there are better technologies to use as alternatives to ActiveX. Currently it's developed with MFC7.1 and it's generated entirely longhand using CRect, CBrush, CFont etc. It's an engine RPM bar that is updated with RPM values and the bar scrolls up and down depending on the rpm value. It also has a few other features like colour changes if the rpm is within certain limits etc. I'm sure you get the gist.
Cheers,
Chris Chambers.
|
|
|
|
|
If we assume the use model of your control is to run in a Web Page in an IE browser (because you posted in the web development forum) then you might want to look into SilverLight and Flash and the other competitors in that space. However I don't believe you will find it a direct replacement for developing an ActiveX for other people to use in developing Web Pages for IE.
|
|
|
|
|
Thanks for your reply led mike.
You assume correctly, it is indeed to run in a web page in a browser. I did start to look at Silverlight but I thought I'd get some feedback from other people before I jumped in with both feet in case there were other alternatives I'd overlooked.
Cheers,
Chris.
|
|
|
|