Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: WSH


Message #1 by marthaj@r... on Sat, 29 Sep 2001 14:18:53
Hi Folks,



  I have looked in BOL and can not find what I need to know about WSH.

THis is what I want to do, Download file and have Ms-word or just the 

viewer popup with the file in the browser window for the client. I am 

uncertain how to tie this all together. I know with the download i can 

change the content type etc, and I know I have to create an instance of 

wsh, but that's as far as I get.

Any help appericated,

thanks so very much

marthaj@r...

Message #2 by "Daniel O'Dorisio" <dodorisio@h...> on Sat, 29 Sep 2001 10:42:30 -0400
Under normal circumstances the word viewer should automatically pop up

if it is configured properly. By just clicking a link to a word dos

(*.doc) I don't think this works in NS, and it dosnt work on a system

without word installed. 



But afaik wsh can not be used on the client unless there is a security

hole, or the application resides on that system (*.hta) if this is in an

intranet enviroment, then you should be able to create a custom object

that could do this for you and have it installed on all the systems.

Then use clientside vbscript to access that object. 



Hth

daniel



-----Original Message-----

From: marthaj@r... [mailto:marthaj@r...] 

Sent: Saturday, September 29, 2001 2:19 PM

To: ASP Web HowTo

Subject: [asp_web_howto] WSH





Hi Folks,



  I have looked in BOL and can not find what I need to know about WSH.

THis is what I want to do, Download file and have Ms-word or just the 

viewer popup with the file in the browser window for the client. I am 

uncertain how to tie this all together. I know with the download i can 

change the content type etc, and I know I have to create an instance of 

wsh, but that's as far as I get.

Any help appericated,

thanks so very much

marthaj@r...



---

You are currently subscribed to asp_web_howto as: dodorisio@h... To

unsubscribe send a blank email to

$subst('Email.Unsub')





Message #3 by "Martha J. Sayers, A.A.B." <marthaj@r...> on Sat, 29 Sep 2001 14:31:34 -0700
thank you responding. here's what I am trying to achieve. I have created

mailing labels, from the users request from the sql db. It displays great on

the brower, but when they go to print it does the natural thing for laser

printer...CREEP...CREEP...CREEP.

So by the end of the page, it's off.

I don't know exactly how to resolve it, but any suggestions would help alot.

thank you so very much,

marthaj



Message #4 by "Daniel O'Dorisio" <dodorisio@h...> on Sat, 29 Sep 2001 15:46:40 -0400
I did a similar thing but I had the server print the labels. So the

server generated them in word, and then printed them to a shared

copier/printer. But that wasn't good enough for some of the lazy people

:-) so I created a com object that accessed the win registry and changed

the current system default printer to one the the user had selected. It

works. I don't know how good it would work under a heavy load, but this

was for a small office (50 systems)



If you redirected them to the .doc file, they should be allright. Is

this in an intranet enviroment? We don't have very many computer

literate people (had to teach how to use the web and email) so I wanted

it as easy as possible, (keep them on a web wizard style page) so that

is why I chose that route. But I would imagine that if all the systems

were running IE and had ms word or word viewer on them, when you

redirected them to the other doc file it should pop up either in a

separate window or in the emedded word. Worst case they would have to

select "Open file from current location" (or click open on ie 6) and it

would open it. 



Anyway. Anyone else have any ideas??



daniel



-----Original Message-----

From: Martha J. Sayers, A.A.B. [mailto:marthaj@r...] 

Sent: Saturday, September 29, 2001 5:32 PM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: WSH





thank you responding. here's what I am trying to achieve. I have created

mailing labels, from the users request from the sql db. It displays

great on the brower, but when they go to print it does the natural thing

for laser printer...CREEP...CREEP...CREEP. So by the end of the page,

it's off. I don't know exactly how to resolve it, but any suggestions

would help alot. thank you so very much, marthaj

Message #5 by "Martha J. Sayers, A.A.B." <marthaj@r...> on Sat, 29 Sep 2001 18:15:22 -0700
Daniel,



  Thank you for responding. As stupid as this is going to sound, how would I

create the msword.doc on the server (since the information will vary and is

extracted from the sql db. )?? I  am pretty weak on  com objects, can you

point me a good direction ??

It's an internet app, so the traffic could be heavy. But for now, I just

want to figure how to rewrite it so it works and prints correctly. The

current labels are written in vbscript using html table commands etc.

thank you so very much,

marthaj



Message #6 by "Daniel O'Dorisio" <dodorisio@h...> on Sat, 29 Sep 2001 20:10:09 -0400
Hmm ok I was thinking you were doing something a little different. Since

you mentioned ms word at the start. 



For an internet application, something that would work really good is

crystal reports, ive heard a lot of good things about it, but never have

had chance to try it (im 16 so my personal budget is kinda small and I

work at a small company) but, here is something you might want to try.



If all your labels are kinda standard, then you can create a mail merge

document with the data source as either a csv file, or a table that is

empty (filled at run time) then when the user selects the criteria for

the records (I build a little javascript sql builder, let me know if it

would help ya any, it isnt really designed to be used by anyone for

anything, but it may help) it will populate either that table, or the

csv file (removing any entries in the table, or overwriting the current

csv) and then you create an instance of ms word (I used vb com to do all

this since it would be faster) on the server and open the mail merge

documant and call the merge method(or whatever it is called). Then you

can save the new document to a folder (reports or whatever) and redirect

the user to that report, they will be prompted to download the file, or

it will open in word. 



Another approach would be to use ms access, this is something I allmost

did, but word was too easy and fitted fine for my application. You can

use access to administer a sql backend, I think it is called access data

projects. Anyway, do that to your db, and then in your asp or com

object, you can (I think) generate a report in access on a query, and

change that query at run time. Open that report, but then you would have

to make it something that would be readable by the end user, so maybe

pdf would help. Either that or send it to word (which kinda defeats

access) 



Either way these options would probally be kinda slow. 



Are you sure the table problem (creeping) isnt just a printer driver

thing? Cause I have had that happen to me in word as well. 



About com objects. They are just activex dll's (or exe's) that contain

code that can be called form an asp. ADO is a com object, CDONTS is a

com object, the FSO is a com object. I can send you that code as well,

if that will help.  And this may not be the most accurate explination of

com, I never have had any real training on anything computer. Just kinda

messed arround with a lot.



hth

Daniel



Daniel O'Dorisio

daniel@o...

www.odorisio-networks.com



-----Original Message-----

From: Martha J. Sayers, A.A.B. [mailto:marthaj@r...] 

Sent: Saturday, September 29, 2001 9:15 PM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: WSH





Daniel,



  Thank you for responding. As stupid as this is going to sound, how

would I create the msword.doc on the server (since the information will

vary and is extracted from the sql db. )?? I  am pretty weak on  com

objects, can you point me a good direction ?? It's an internet app, so

the traffic could be heavy. But for now, I just want to figure how to

rewrite it so it works and prints correctly. The current labels are

written in vbscript using html table commands etc. thank you so very

much, marthaj
Message #7 by "Martha J. Sayers, A.A.B." <marthaj@r...> on Sun, 30 Sep 2001 08:56:59 -0700
Daniel,



  Thank you for responding. Crystal Reports are a great product, used it

quite a bit over the years in R:Base and VB etc. They have a version just

for internet printing, but whne I talked to them about cost , the quote was

unreal and prohibitive.And I feel kinda stupid because I do use com objects,

I was used to making my own dll's etc and exe's. Guess I never stop to think

about it. And isn't that stupid since I use ado for connections and fso for

uploading and downloading !!!

Could you send me the code ?? I would appericate it. I guess what stumps me

is how, and I don't know how to express this, is how do I creat the word doc

on the server to begin with ?? I mean, what does have to be on the web

server ?? I can create a cvs file and I understand about the datasource on

the document, I just can not picture how I create the doc on server and tie

into it, what needs to be loaded on the server.

I can require the users to have atleast the MsWord Viewer on their

machines.It's a freeie from ms anyhow.

  Creeping is a common thing on the laser printers, it's usually caused by

the printer and lines on report not matching. I have always set, physically,

to 58 lines.60 max.

I know people do this all the time, and I aim to laearn how to do it too !!

thank you again so much

marthaj@r...









Message #8 by "Daniel O'Dorisio" <dodorisio@h...> on Sun, 30 Sep 2001 13:39:25 -0400
Martha,



Ill send all the code I used to you tomorrow afternoon. It is all up at

the office so ill have to get it when I go in after school.



Creating the word doc on the server is very simple, easier then you

think. What you do is create a mail merge main document (the layout with

the datasource. I created the layout and used a csv file as a

datasource. Then you use the com object (custom) to fill the csv with

the information for that report. Then you open word on the server

(server.createobject, or set objword = new word.application) and open

that mail merge document. Then call the merge to new document method,

and you will get a new document, make sure that is the activedocument.

And then save it as a unique name. Then once this is completed. You can

redirect the user to that word document, and they will be presented to

download it. 



I hope this is clear, ill comment my code better, and send you the word

doc, as well as a sample data source.



One warning about this, it dosnt scale well, word is SLOW! So you will

have to do some heavy testing. I would use the microsoft web test

utility to simulate many connections and test it all out. Try to break

it:-) 



Daniel



--------------------------

Daniel O'Dorisio

daniel@o...

www.odorisio-networks.com

--------------------------



-----Original Message-----

From: Martha J. Sayers, A.A.B. [mailto:marthaj@r...] 

Sent: Sunday, September 30, 2001 11:57 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: WSH





Daniel,



  Thank you for responding. Crystal Reports are a great product, used it

quite a bit over the years in R:Base and VB etc. They have a version

just for internet printing, but whne I talked to them about cost , the

quote was unreal and prohibitive.And I feel kinda stupid because I do

use com objects, I was used to making my own dll's etc and exe's. Guess

I never stop to think about it. And isn't that stupid since I use ado

for connections and fso for uploading and downloading !!! Could you send

me the code ?? I would appericate it. I guess what stumps me is how, and

I don't know how to express this, is how do I creat the word doc on the

server to begin with ?? I mean, what does have to be on the web server

?? I can create a cvs file and I understand about the datasource on the

document, I just can not picture how I create the doc on server and tie

into it, what needs to be loaded on the server. I can require the users

to have atleast the MsWord Viewer on their machines.It's a freeie from

ms anyhow.

  Creeping is a common thing on the laser printers, it's usually caused

by the printer and lines on report not matching. I have always set,

physically, to 58 lines.60 max. I know people do this all the time, and

I aim to laearn how to do it too !! thank you again so much

marthaj@r...





Message #9 by "Martha J. Sayers, A.A.B." <marthaj@r...> on Sun, 30 Sep 2001 16:32:47 -0700
Daniel,



  Thank you, I will be waiting for the code. And thank you again for all you

help and taking the time to response. I be in touch..

:-)

marthaj








  Return to Index