Connecting Tech Pros Worldwide Forums | Help | Site Map

OPENING WORD2000 DOCUMENT WITH JAVASCRIPT

Cedric
Guest
 
Posts: n/a
#1: Jun 28 '06
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


Erwin Moller
Guest
 
Posts: n/a
#2: Jun 28 '06

re: OPENING WORD2000 DOCUMENT WITH JAVASCRIPT


Cedric wrote:
[color=blue]
> 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[/color]

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
Cedric
Guest
 
Posts: n/a
#3: Jun 28 '06

re: OPENING WORD2000 DOCUMENT WITH JAVASCRIPT


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 :
[color=blue]
> Cedric wrote:
>[color=green]
> > 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[/color]
>
> 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[/color]

Richard Cornford
Guest
 
Posts: n/a
#4: Jun 28 '06

re: OPENING WORD2000 DOCUMENT WITH JAVASCRIPT


Cedric wrote:
<snip>[color=blue]
> // var oPathTemplate = "C:\\temp\\Template.dot"
> var oPathTemplate = "http:////myserver///Modeles//Template.dot"[/color]
<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.

Cedric
Guest
 
Posts: n/a
#5: Jun 28 '06

re: OPENING WORD2000 DOCUMENT WITH JAVASCRIPT


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 :
[color=blue]
> Cedric wrote:
> <snip>[color=green]
> > // var oPathTemplate = "C:\\temp\\Template.dot"
> > var oPathTemplate = "http:////myserver///Modeles//Template.dot"[/color]
> <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.[/color]

Richard Cornford
Guest
 
Posts: n/a
#6: Jun 28 '06

re: OPENING WORD2000 DOCUMENT WITH JAVASCRIPT


Cedric wrote:[color=blue]
> Hi Richard,[/color]
<snip>[color=blue]
> May be you have anothers ideas about this.[/color]
<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.


Closed Thread