Forum Moderators: open

Message Too Old, No Replies

ASP to Word/PDF?

         

axeman420

4:39 pm on Aug 3, 2004 (gmt 0)

10+ Year Member



Hey guys,

I need to know what would be the best way to go about converting a dynamically created ASP page to a format where any user can save to their desktop. The final document would be protected for changes. So far I have it set up to where the user inputs the information into a form through the browser and then an ASP page outputs a Word document. The only problem that I find with this is that I cannot set the page margins for the Word Document and thus whenever the user would try to print the Word document it doesn't come out right. In addition, is there any way to create the Word document from a template or something? Finally, would PDF be a better solution and is there a free type of PDF solution?

mattglet

5:33 pm on Aug 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PDF would be the best option, but there's no good free components. I actually just got done with a project where I needed to create PDF's from info taken from a database. I found a couple of good solutions, that do exactly what I needed. It's pretty intensive, but it's definitely worth it in the end.

axeman420

7:33 pm on Aug 3, 2004 (gmt 0)

10+ Year Member



So no go on ASP outputting a Word document?

Anyone know how to set the page margins in Word through ASP? If I can get that then I can get this to work.

Your help is greatly appreciated!

Thanks,
Axe

txbakers

7:48 pm on Aug 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a similar situation, but I don't export to Word or PDF. I just format the resulting web page as best as I could, tell the users to delete headers and footers and set all margins to 0, and cross my fingers. It works in 98% of the cases, even printing to mailing label stock.

But I'll admit it's not the ideal solution.

there are also PDF printing components which the user can purchase as needed, which allows the user to "print" directly to PDF. I've recommended this before and it really helps.

Formatting web pages to a specific format is difficult, but doable with patience.

axeman420

8:01 pm on Aug 3, 2004 (gmt 0)

10+ Year Member



txbakers,

Your input just gave me an idea that I think will probably work. I can just create the regular HTML page through the form that is handled through my ASP code. Then once the final HTML document has been created the user can "Print" to PDF using Adobe PDF Writer. Two birds killed with one stone. Easier for me and free for the client. No? Please provide your thoughts...

Axe

encyclo

8:08 pm on Aug 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about this for starters?:

How To Use ASP to Generate a Rich Text Format (RTF) Document to Stream to Microsoft Word [support.microsoft.com]

It is more to do with automating Office than for a web app, but there might be some useful info in there for you.

axeman420

8:25 pm on Aug 3, 2004 (gmt 0)

10+ Year Member



Is there a way to control page margins with RTF?

Just found out that the client needs to have the ability to add to the file after it has been created so creating a PDF file may be out of the question.

Please please please...can anybody help!?!?!? lol

Thanks in advance,
Axe

mattglet

9:31 pm on Aug 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you just streaming the content as a Word file, or are you actually creating a Word.Application object?

axeman420

7:34 pm on Aug 4, 2004 (gmt 0)

10+ Year Member



I am streaming the content as a word file via:

<% Response.ContentType = "application/msword" %>
<% Response.AddHeader "Content-Disposition", "attachment;filename=FILENAMEHERE.doc" %>

Is this wrong or can it be controlled via the Word.Application object? How would I go about using the Word.Application in ASP?

Thanks for all the help...

Axe

axeman420

4:16 pm on Aug 9, 2004 (gmt 0)

10+ Year Member



?

mattglet

10:37 pm on Aug 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately, I've never dealt with the Word object, so I'm not real sure what it's limitations/requirements are.

Here's a link [msdn.microsoft.com] about it that I just found.

wackal

9:27 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



I was looking into this also, as I needed to generate some type of word doc on an intranet website. The information I came across said that Word is a resource hog when used with ASP. I was advised to output in RTF (rich text format) instead. This would be much easier for the server. Try this link for some good info:

[devx.com...]