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

OPENING WORD2000 DOCUMENT WITH JAVASCRIPT

P: n/a
Hi Folks,

I'm wondering if someone has already succeed to open a word2000
document located on server side with javascript code executed by a web
browser on client side.

In fact, i make it without any problem when the client use Word XP &
2003 but no result with Word 2000.

Any suggestions are welcomed,

Thanks in advance for you help,

Cedric

Jun 28 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Cedric wrote:
Hi Folks,

I'm wondering if someone has already succeed to open a word2000
document located on server side with javascript code executed by a web
browser on client side.

In fact, i make it without any problem when the client use Word XP &
2003 but no result with Word 2000.

Any suggestions are welcomed,

Thanks in advance for you help,

Cedric


Hi,

It depends on what you mean excactly by 'opening a word document'.
Do you mean that the URL of a window points to some word-document on your
server?

In that case most browsers will open it. IE will open it in its own
IE-window. Other browsers might suggest, but ask you first, if you want to
open the document with the default extensionhandler.

I do not expect a difference for word2003 and word2000, so I am suprised you
find one.

Could you show us the code you use?

Regards,
Erwin Moller
Jun 28 '06 #2

P: n/a
Hi Erwin,

Thanks to follow my case.

Exactly, i mean that the URL of a window points to some word-document
on my server.
But if i use a network path or local path instead the URL the
application works fine.

I get this problem only with Word2000.

Here a piece of my javascript code :

function opendoc(){

if (window.ActiveXObject) {
try {
var app_word = new ActiveXObject("Word.Application");
var doc_word = new ActiveXObject("Word.Document");
} catch (e) {} }

if (!app_word) {
alert('Abandon : Impossible de créer une instance
Word.Application.');
return false;
}
else
{
// var oPathTemplate = "C:\\temp\\Template.dot"
var oPathTemplate = "http:////myserver///Modeles//Template.dot"
try {

/* Add document */
doc_word = app_word.Documents.add(oPathTemplate);

if (!doc_word) {
alert('Abandon : Impossible de créer un document Word.');
app_word.Quit(0);
return false;
}

/* Activation document */
doc_word.Activate();

/* Make it visible*/
app_word.Application.Visible = true;
}

}

Erwin Moller a écrit :
Cedric wrote:
Hi Folks,

I'm wondering if someone has already succeed to open a word2000
document located on server side with javascript code executed by a web
browser on client side.

In fact, i make it without any problem when the client use Word XP &
2003 but no result with Word 2000.

Any suggestions are welcomed,

Thanks in advance for you help,

Cedric


Hi,

It depends on what you mean excactly by 'opening a word document'.
Do you mean that the URL of a window points to some word-document on your
server?

In that case most browsers will open it. IE will open it in its own
IE-window. Other browsers might suggest, but ask you first, if you want to
open the document with the default extensionhandler.

I do not expect a difference for word2003 and word2000, so I am suprised you
find one.

Could you show us the code you use?

Regards,
Erwin Moller


Jun 28 '06 #3

P: n/a
Cedric wrote:
<snip>
// var oPathTemplate = "C:\\temp\\Template.dot"
var oPathTemplate = "http:////myserver///Modeles//Template.dot"

<snip>

In javascript string literals the backslash character has a special
meaning, in that it is the escape character. So if you want to write a
Windows path the backslashes in the path need to be escaped by
preceding them with a backslash each. The forward slash character has
no special meaning and so your HTTP URL is literally the characters you
wrote, and is extremely unlikely to be effective. Something more like:-

var oPathTemplate = "http://myserver/Modeles/Template.dot";

- would be expected.

Richard.

Jun 28 '06 #4

P: n/a
Hi Richard,

Thanks, that's true what you said. but i still get an error, even if i
write well my URL :
var oPathTemplate = "http://myserver/Modeles/Template.dot";

May be you have anothers ideas about this.

Regards,

Cedric

Richard Cornford a écrit :
Cedric wrote:
<snip>
// var oPathTemplate = "C:\\temp\\Template.dot"
var oPathTemplate = "http:////myserver///Modeles//Template.dot"

<snip>

In javascript string literals the backslash character has a special
meaning, in that it is the escape character. So if you want to write a
Windows path the backslashes in the path need to be escaped by
preceding them with a backslash each. The forward slash character has
no special meaning and so your HTTP URL is literally the characters you
wrote, and is extremely unlikely to be effective. Something more like:-

var oPathTemplate = "http://myserver/Modeles/Template.dot";

- would be expected.

Richard.


Jun 28 '06 #5

P: n/a
Cedric wrote:
Hi Richard, <snip> May be you have anothers ideas about this.

<snip>

Maybe, but first I would have to read what you have written and as you
have top-posted it and not quoted the context of your responses the
effort of reading it has passed over the threshold of willingness.

Richard.
Jun 28 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.