Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > opening a client application from a server?

Reply
Thread Tools

opening a client application from a server?

 
 
ccc31807
Guest
Posts: n/a
 
      05-07-2009
This relates to the post I made last week about working with
WordProcessingML. That part turned out to be easy -- as easy as
writing a CGI script and dynamically updating the HTML from a
database. WordProcessingML is no different from XHTML and does pretty
good at creating Word documents.

Here's the question: The client has a requirement that the users
create a Word document on a web enabled app and open it in the client
browser. I can create the word document and open it on the server
(using this command -- exec("c:/Program Files/Microsoft Office/
OFFICE12/winword.exe", "c:/TEST1.DOC")) but I can't get Word to open
the file on the client. I can write the .doc file to a directory and
give the client to the directory over the internet, but that doesn't
meet the requirement.

I've tried creating hyperlink like <a href="test.doc">Here is your
Word document</a> but that doesn't work either.

I'm about to tell my client that I can't meet this requirement ...
I've been trying since Monday and have about given up. Any ideas?

Thanks, CC.
 
Reply With Quote
 
 
 
 
Tad J McClellan
Guest
Posts: n/a
 
      05-07-2009
ccc31807 <(E-Mail Removed)> wrote:

> Here's the question: The client has a requirement that the users
> create a Word document on a web enabled app and open it in the client
> browser. I can create the word document and open it on the server
> (using this command -- exec("c:/Program Files/Microsoft Office/
> OFFICE12/winword.exe", "c:/TEST1.DOC")) but I can't get Word to open
> the file on the client.



If I'm understanding you correctly, then you do not have a Perl problem.

If you send the appropriate (application/word?) Content-Type, then a
client on Windows, with Word installed, should be able to open it
no problem.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
 
 
 
smallpond
Guest
Posts: n/a
 
      05-07-2009
On May 7, 4:00*pm, Tad J McClellan <(E-Mail Removed)> wrote:
> ccc31807 <(E-Mail Removed)> wrote:
> > Here's the question: The client has a requirement that the users
> > create a Word document on a web enabled app and open it in the client
> > browser. I can create the word document and open it on the server
> > (using this command -- exec("c:/Program Files/Microsoft Office/
> > OFFICE12/winword.exe", "c:/TEST1.DOC")) but I can't get Word to open
> > the file on the client.

>
> If I'm understanding you correctly, then you do not have a Perl problem.
>
> If you send the appropriate (application/word?) Content-Type, then a
> client on Windows, with Word installed, should be able to open it
> no problem.
>


Here's an example showing the headers which IE opens fine:

wget -S http://www.ahrq.gov/QUAL/diabqguide.doc
--17:36:37-- http://www.ahrq.gov/QUAL/diabqguide.doc
Resolving www.ahrq.gov... 77.67.91.107
Connecting to www.ahrq.gov|77.67.91.107|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Content-Length: 1694208
Content-Type: application/msword
Last-Modified: Fri, 30 May 2008 17:20:13 GMT
Accept-Ranges: bytes
ETag: "10bb8b6b79c2c81:6b7"
Server: Microsoft-IIS/6.0
p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
X-Powered-By: ASP.NET
Date: Thu, 07 May 2009 21:36:37 GMT
Connection: keep-alive
Length: 1694208 (1.6M) [application/msword]
Saving to: `diabqguide.doc.1'
 
Reply With Quote
 
ccc31807
Guest
Posts: n/a
 
      05-08-2009
On May 7, 4:00*pm, Tad J McClellan <(E-Mail Removed)> wrote:
>
> If I'm understanding you correctly, then you do not have a Perl problem.


It's very possible that it's an Apache problem, but maybe not. I can
invoke Word and open the .doc file in an ordinary Perl script, like
this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")

However, it doesn't work in a CGI script, and frankly I don't know
enough about Windows to troubleshoot it. I'm meeting with my client
tomorrow morning, and either I'll get it to work before then or I'll
suggest some alternatives.

> If you send the appropriate (application/word?) Content-Type, then a
> client on Windows, with Word installed, should be able to open it
> no problem.


My job entails producing a lot of reports in various formats (csv,
pdf, txt, etc) and I have a lot of experience giving users access to
these formats. Producing the Word document with WPML was easy, but now
I'm stuck with producing files that I can't seen to open. Ignorance
isn't bliss!

CC
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-08-2009
ccc31807 <(E-Mail Removed)> wrote:
>On May 7, 4:00*pm, Tad J McClellan <(E-Mail Removed)> wrote:
>>
>> If I'm understanding you correctly, then you do not have a Perl problem.

>
>It's very possible that it's an Apache problem, but maybe not.


No, it's not an Apache problem, either. It's an HTTP problem.

>I can
>invoke Word and open the .doc file in an ordinary Perl script, like
>this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")
>
>However, it doesn't work in a CGI script, and frankly I don't know


Oh yes, it does work in a CGI script. Given proper permissions the
script will/should happily invoke Word ---- on the server! Most likely
not what you had in mind.

>enough about Windows to troubleshoot it.


Has nothing to do with Windows but everything with how HTTP works.

>I'm meeting with my client
>tomorrow morning, and either I'll get it to work before then or I'll
>suggest some alternatives.
>
>> If you send the appropriate (application/word?) Content-Type, then a
>> client on Windows, with Word installed, should be able to open it
>> no problem.

>
>My job entails producing a lot of reports in various formats (csv,
>pdf, txt, etc) and I have a lot of experience giving users access to
>these formats. Producing the Word document with WPML was easy, but now
>I'm stuck with producing files that I can't seen to open. Ignorance
>isn't bliss!


So, what Content-Type did you try?

jue
 
Reply With Quote
 
ccc31807
Guest
Posts: n/a
 
      05-08-2009
jue, thanks for your comments.

On May 7, 8:46*pm, Jürgen Exner <(E-Mail Removed)> wrote:
> No, it's not an Apache problem, either. It's an HTTP problem.


This is what I can't understand. I import a big glob of data from a
database into my script, generate many csv files, or txt files, or pdf
files, or xml file, etc., and generate links. The browsers, IE but FF
as well will happily open a csv file in Excel (assuming that the
client is a Windows machine with Office installed), open a pdf file in
Acrobat, open a txt file in the browser window, and so on.

I ASSUMED(!) that a doc file would work the same way, that is, open
natively in Word on a machine running Office. It doesn't, and I don't
know enough to understand why it doesn't.

> Oh yes, it does work in a CGI script. Given proper permissions the
> script will/should happily invoke Word ---- on the server! Most likely
> not what you had in mind.


Right. What I had in mind was writing an OUTFILE to a directory and
creating a link to the file. I frequently create HTML files
dynamically from a script (similar to what I suppose eBay, Amazon,
Google, and all the rest do) and the links work flawlessly. Invoking
Word on the server is useless, you are right about that.

> Has nothing to do with Windows but everything with how HTTP works.
> So, what Content-Type did you try?


I didn't. When I produce csv, pdf, etc., I don't specify any Content-
Type. I just create the files and they open the way they should. XML
is very picky, and Word demands a PERFECT(!) XML file to open,
otherwise it throws an error, and I suspect that an attempt to
incorporate a Content-Type element in the XML would create a problem.
Besides, I don't understand why a Content-Type is necessary.

I don't mind admitting ignorance, but I'm not stupid, and I do learn
-- slowly but surely.

CC
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-08-2009
ccc31807 <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> On May 7, 4:00*pm, Tad J McClellan <(E-Mail Removed)> wrote:
>>
>> If I'm understanding you correctly, then you do not have a Perl
>> problem.

>
> It's very possible that it's an Apache problem, but maybe not. I can
> invoke Word and open the .doc file in an ordinary Perl script, like
> this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")


What is this new wave of people thinking that a web server can invoke a
specific application on a client computer?

I am simply blown by this failure to grasp the most basic elements of
how things fit together.

> However, it doesn't work in a CGI script, and frankly I don't know
> enough about Windows to troubleshoot it.


You do not need to know anything about Windows.

>> If you send the appropriate (application/word?) Content-Type, then a
>> client on Windows, with Word installed, should be able to open it
>> no problem.

>
> My job entails producing a lot of reports in various formats (csv,
> pdf, txt, etc) and I have a lot of experience giving users access to
> these formats.


How is a Word document different from any of those formats? Tad has just
told you how to solve your problem.

Sinan
--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-08-2009
"A. Sinan Unur" <(E-Mail Removed)> wrote in
news:Xns9C04DBD74FE17asu1cornelledu@127.0.0.1:

> I am simply blown by this failure ...

^
away

*Sigh*

Sinan
--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-08-2009
ccc31807 <(E-Mail Removed)> wrote:
>jue, thanks for your comments.
>
>On May 7, 8:46*pm, Jürgen Exner <(E-Mail Removed)> wrote:
>> No, it's not an Apache problem, either. It's an HTTP problem.

>
>This is what I can't understand. I import a big glob of data from a
>database into my script, generate many csv files, or txt files, or pdf
>files, or xml file, etc., and generate links. The browsers, IE but FF
>as well will happily open a csv file in Excel (assuming that the
>client is a Windows machine with Office installed), open a pdf file in
>Acrobat, open a txt file in the browser window, and so on.


Which IMNSHO is a major mistake of the browser. The browser should never
assume a file type based on the last 3 characters of a file name.

>I ASSUMED(!) that a doc file would work the same way, that is, open
>natively in Word on a machine running Office. It doesn't, and I don't
>know enough to understand why it doesn't.
>
>> Has nothing to do with Windows but everything with how HTTP works.
>> So, what Content-Type did you try?

>
>I didn't. When I produce csv, pdf, etc., I don't specify any Content-
>Type. I just create the files and they open the way they should. XML
>is very picky, and Word demands a PERFECT(!) XML file to open,
>otherwise it throws an error, and I suspect that an attempt to
>incorporate a Content-Type element in the XML would create a problem.


You don't incorporate it into the XML, you set the Content-Type in the
HTTP response header just as Tad explained already.
And no, it really has nothing to do with Perl.

>Besides, I don't understand why a Content-Type is necessary.


Because it tells the browser what to do with that particular HTTP
response.

jue
 
Reply With Quote
 
ccc31807
Guest
Posts: n/a
 
      05-08-2009
> > I am simply blown by this failure ...
>
> * * * * * * * * * *^
> * * * * * * * * * away
>
> *Sigh*


Reminds me of a very crude example of how capitalization or the lack
thereof can change the meaning, as in, "I helped my Uncle Jack off a
horse."

CC
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone resolved links opening blank page? or box opening in Outlook 2000? S.Rodgers Firefox 13 12-16-2005 03:07 PM
Word file not opening from Adm -My recent docs but opening from file menu of Word Thaqalain Computer Support 0 06-30-2005 02:20 AM
Downloading/opening file in client application window Rob Nicholson ASP .Net 3 05-13-2005 02:26 AM
Opening Office Application on client =?Utf-8?B?UGFyYWcgSm9zaGk=?= ASP .Net 2 01-21-2004 06:31 PM
need some help with dial box opening when opening a folder John Computer Information 0 11-13-2003 08:38 PM



Advertisments