This is cut and paste from previous discussion.
Rule of thumb: NO server-side ms office api calls because
it renders your server unstable and insecure. Plus
Microsoft does not allow server-side thru very restrictive
licensing. You are limited to client-side activeX calls
from your browser like below. Check that out. Also read
the links I enclosed further down in the discussion.
Good luck,
Yuri
. Reply (E-mail) Forward (E-mail)
Subject: Re: Client-side Word Automation from asp.net
From: "an*******@disc ussions.microso ft.com"
<an*******@disc ussions.microso ft.com> Sent: 12/3/2003
11:25:41 AM
Thanks Steve! This should get it started:
<script language="javas cript">
var word = new ActiveXObject(" Word.Applicatio n");
word.Visible = true;
word.Documents. Add("Normal", false, 0);
var range = word.ActiveDocu ment.Range(0, 0);
range.InsertBef ore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertPar agraphAfter();
//var pause = 0;
//var nopause = 1;
//var wdDialogFileOpe n = 80;
//var wdDialogToolsOp tionsSpellingAn dGrammar = 203;
//var dialog = word.Dialogs
(wdDialogToolsO ptionsSpellingA ndGrammar);
//var button = dialog.Show(1);
//word.ActiveDocu ment.CheckGramm ar();
//word.ActiveDocu ment.CheckSpell ing();
//word.ActiveDocu ment.SaveAs("My doc.txt", 4);
word.Quit();
</script>
-----Original Message-----
Take a look at the client side example in this article
(near the end):http://www.aspnetpro.com/NewsletterA...003/09/asp2003
09so_l/asp200309so_l.a sp
The example uses Excel but it should still be helpful to
you.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-
consulting.com
"Yuri Vanzine" <yp*@tft.com> wrote in message
news:1a******* *************** ******@phx.gbl. .. In asp we can run VBSCRIPT client-side which allows
for 'easy' :?) ms office COM object instantiation. How
do I access a Word object in ASP.NET on the client side?
I would like to do spell checking from a web-based
wysiwyg editor and I am limited to using ms word from the
client, server-side word automation is out of the question for
several important reasons
(http://support.microsoft.com/default.aspx?
scid=http://support.microso ft.com:80/support/kb/articles/Q2 57/7/57.asp&NoWebCon tent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.
Any help will be appreciated!
Thanks,
yv
.
..
-----Original Message-----
Hi,
Being fairly new to .NET I am looking for a way to call
MS
Word from an event on a webform, and after the user is
finished save that created document to an SQL Server
database. Has anyone done this? Does it seem possible? I
followed the instructions from a sample on the Microsoft
knowledge base but it only seems to work when creating a
VB.NET Windows .EXE, not an VB.NET ASP app.
Imports Word=Microsoft. Office.Interop. Word
Dim oWord As Word.Applicatio n
Dim oDoc As Word.Document
'Start Word and open the document template.
oWord = CreateObject("W ord.Application ")
oWord.Visible = True
oDoc = oWord.Documents .Add
I changed the sample code to the following:
Dim oWord As Word.Applicatio nClass
Dim oDoc As Word.DocumentCl ass
'Start Word and open the document template.
oWord = New Word.Applicatio nClass()
oWord.Visible = True
oDoc = oWord.Documents .Add
But when i build the solution it gives me the following
error:
Access Denied
Exception Details: System.Unauthor izedAccessExcep tion:
Access is denied.
The ASP.NET process is not authorized to access the
request. For security reasons the default ASP.NET process
is '{machinename}\ ASPNET' which has limited privileges.
Consider granting access rights to the resource to the
ASP.NET process identity.
Line 31: oWord = New Word.Applicatio nClass()
But it does not specify what it is trying to gain access
to. I tried giving the asp account admin rights just to
test but that didnt work. I also lowered to security
settings on IE to test as well, and I gave the ASPNET
account full access to the
Microsoft.Offi ce.Interop.Word .dll.
Any ideas?
Thanks.
.