Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2006

Tip: Looking for answers? Try searching our database.

Interop Word problem+ASP.NET page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hospital S.Sebastiao - 05 Sep 2006 17:22 GMT
Hi, i'm in desperate need of help to fix a problem that i have, the problem
is the following:
I have an ASP.NET aplication that to open an word template document, this
aplication is in C#(using .NET 1.1 and VS2003), i have register the office
interop DLL in the GAC an have also install the office program in the
machine, this is in a virtual machine that i use to make the development, on
the host machine i have the same interop DLL's and  the office suite install,
use the .NET 2.0 and the VS2005 to create a test aplication that opens the
same template this code works fine, but the on in the virtual machine gives
me an error on this line " Document wordDoc = wordapp.Documents.Open(ref
testedoc,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);" it says "The command is not available", i
don't know what the problem might be, but need to solve this problem ot
finish the project. Thanks in advance for any help provided, surely
appreciate it.

ApplicationClass wordapp = new ApplicationClass();
       object missing = Missing.Value;
       object testedoc = @"E:\My Documents\Visual Studio
2005\WebSites\webword\Politica-Plano.dot";
       object documento = @"E:\My Documents\Visual Studio
2005\WebSites\webword\teste.doc";
       Document wordDoc = wordapp.Documents.Open(ref testedoc,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);
       wordDoc.Activate();
       wordapp.Selection.TypeText("ola isto é um teste");
       wordapp.Selection.TypeParagraph();
       ReplaceBookmark(wordDoc,"nomedocumento","Testando o documento com
bookmarks");
       wordDoc.SaveAs(ref documento,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);
       wordapp.Quit(ref missing,ref missing,ref missing);
       Response.Clear();
       Response.ContentType = "application/doc";
       Response.AddHeader("Content-Disposition",
"attachment;filename=testedoc.doc;");
       Response.WriteFile(documento.ToString());
daniel # - 06 Sep 2006 03:37 GMT
Maybe you have other version in the virtual machine, At www.microsoft.com 
you can download the PIA (primary interop assemblies)  to use interop on ms
office.

regards
daniel

> Hi, i'm in desperate need of help to fix a problem that i have, the
> problem
[quoted text clipped - 43 lines]
> "attachment;filename=testedoc.doc;");
>        Response.WriteFile(documento.ToString());
Hospital S.Sebastiao - 06 Sep 2006 09:10 GMT
They are the same, as is the office version

> Maybe you have other version in the virtual machine, At www.microsoft.com 
> you can download the PIA (primary interop assemblies)  to use interop on ms
[quoted text clipped - 50 lines]
> > "attachment;filename=testedoc.doc;");
> >        Response.WriteFile(documento.ToString());
Lebza - 15 Sep 2006 07:33 GMT
Hey this is very funny i'm having the same problem.

Exactly like yours i'm trying to open Word on Virtual PC. I'm using
Asp.net 2.0 ( vb.net)
This was working fine yesterday and all of a sudden is not working. It
tells me "This command is not available" I know very well is not my
code cause it was working fine yesterday...Ooh one other thing my MS
Office  is not activated. So i am going to activate this and see where
this takes me

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.