By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,594 Members | 3,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,594 IT Pros & Developers. It's quick & easy.

Client-side Word Automation from asp.net

P: n/a
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.microsoft.com:80/support/kb/articles/Q2
57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.

Any help will be appreciated!

Thanks,

yv
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Take a look at the client side example in this article (near the end):
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

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.microsoft.com:80/support/kb/articles/Q2
57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.

Any help will be appreciated!

Thanks,

yv

Nov 18 '05 #2

P: n/a
Thanks Steve! This should get it started:

<script language="javascript">
var word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Add("Normal", false, 0);
var range = word.ActiveDocument.Range(0, 0);
range.InsertBefore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertParagraphAfter();
//var pause = 0;
//var nopause = 1;
//var wdDialogFileOpen = 80;
//var wdDialogToolsOptionsSpellingAndGrammar = 203;
//var dialog = word.Dialogs
(wdDialogToolsOptionsSpellingAndGrammar);
//var button = dialog.Show(1);

//word.ActiveDocument.CheckGrammar();
//word.ActiveDocument.CheckSpelling();
//word.ActiveDocument.SaveAs("Mydoc.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.asp
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.microsoft.com:80/support/kb/articles/Q2 57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.

Any help will be appreciated!

Thanks,

yv

.

Nov 18 '05 #3

P: n/a
Thanks! As a follow-up, this works when you enable unsafe
activeX in IE:

<script language="javascript">
var word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Add("Normal", false, 0);
var range = word.ActiveDocument.Range(0, 0);
range.InsertBefore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertParagraphAfter();
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.asp
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.microsoft.com:80/support/kb/articles/Q2 57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.

Any help will be appreciated!

Thanks,

yv

.

Nov 18 '05 #4

P: n/a

Be sure to check if object creation was successful, in case the client was
not able to create the Word object.

if (word==null)
// do it
else
// notify user to install word ;-)

otherwise your page will give your user some ugly looking output....

-= Maarten van Stam =-
aa******@REMOVETHISFORNOSPAMhotmail.com

<an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Thanks! As a follow-up, this works when you enable unsafe
activeX in IE:

<script language="javascript">
var word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Add("Normal", false, 0);
var range = word.ActiveDocument.Range(0, 0);
range.InsertBefore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertParagraphAfter();
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.asp

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.microsoft.com:80/support/kb/articles/Q2 57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.

Any help will be appreciated!

Thanks,

yv

.

Nov 18 '05 #5

P: n/a
Hmmm, this should be ... was a bit to hasty entering the code ;-)

if (word==null)
// notify user to install word ;-)
else
// Do it

-= Maarten van Stam =-
aa******@REMOVETHISFORNOSPAMhotmail.com

"Joe Dokus" <no****@nospamnospamnospam.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...

Be sure to check if object creation was successful, in case the client was
not able to create the Word object.

if (word==null)
// do it
else
// notify user to install word ;-)

otherwise your page will give your user some ugly looking output....

-= Maarten van Stam =-
aa******@REMOVETHISFORNOSPAMhotmail.com

<an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Thanks! As a follow-up, this works when you enable unsafe
activeX in IE:

<script language="javascript">
var word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Add("Normal", false, 0);
var range = word.ActiveDocument.Range(0, 0);
range.InsertBefore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertParagraphAfter();
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.asp

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.microsoft.com:80/support/kb/articles/Q2
> 57/7/57.asp&NoWebContent=1) . Although this
> (http://www.codeproject.com/aspnet/wordapplication.asp)
> article helps a little bit.
>
> Any help will be appreciated!
>
> Thanks,
>
> yv
.


Nov 18 '05 #6

P: n/a
Hi All

I tried to display print dialog for word, but it didn't work. I tried with the following code.

var word = new ActiveXObject("Word.Application");

word.Visible = true
var pause = 0
var nopause = 1
var wdDialogFilePrint = 88
word.Documents.Open("C:\\MyDoc.doc")
var dialog = word.Dialogs(wdDialogFilePrint)
var button = dialog.Show(1)

word.Quit()

Will anybody help me in displaying the print dialog and sending the word document to the selected printer using javascript

Thanks in Advance.
Siva

Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.