Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to populate a word file from within ASP.NET and stream it out to the client?

Reply
Thread Tools

How to populate a word file from within ASP.NET and stream it out to the client?

 
 
Daniel Walzenbach
Guest
Posts: n/a
 
      07-29-2004
Hi,

I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed).
The preferable solution would be to have a word template on the server which is populated in the asp.net application and then streamed out to the user.
Also acceptable would be to open a template on the client's computer using automation and fill this file (if this is possible).

Does anybody know how this can be done? Which way would be preferable? Create the file on the server and streaming it out to the user or using automation to populate a file on the client's computer?
I know that it's possible to sent html to excel (via automation) which is then nicely rendered (like in the following example).

<script language="vbscript">
Sub Button1_onclick()
Dim sHTML
sHTML = window.Form1.children("DataGrid1").outerhtml
Dim oXL, oBook
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oXL.Visible = true
oXL.UserControl = true
end sub
</script>

Is there something similar possible with word? If


Thank you a lot for your help!

Daniel Walzenbach
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      07-29-2004
This article demonstrates a number of techniques for generating Excel and Word documents.
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

Here's a good 3rd party product you could use if you need to get really fancy:
http://www.aspose.com/Products/Aspose.Word/
And here's another:
www.officewriter.com

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Daniel Walzenbach" <> wrote in message news:...
Hi,

I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed).
The preferable solution would be to have a word template on the server which is populated in the asp.net application and then streamed out to the user.
Also acceptable would be to open a template on the client's computer using automation and fill this file (if this is possible).

Does anybody know how this can be done? Which way would be preferable? Create the file on the server and streaming it out to the user or using automation to populate a file on the client's computer?
I know that it's possible to sent html to excel (via automation) which is then nicely rendered (like in the following example).

<script language="vbscript">
Sub Button1_onclick()
Dim sHTML
sHTML = window.Form1.children("DataGrid1").outerhtml
Dim oXL, oBook
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oXL.Visible = true
oXL.UserControl = true
end sub
</script>

Is there something similar possible with word? If


Thank you a lot for your help!

Daniel Walzenbach
 
Reply With Quote
 
 
 
 
Daniel Walzenbach
Guest
Posts: n/a
 
      07-29-2004
Steve,



Thank you for your immediate answer. Could you please tell me what I would have to do if I wanted to use automation and be able to access some fields within a template? How would I have to declare those fields and how could they be accessed?



Thank you!

Daniel

"Steve C. Orr [MVP, MCSD]" <> schrieb im Newsbeitrag news:...
This article demonstrates a number of techniques for generating Excel and Word documents.
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

Here's a good 3rd party product you could use if you need to get really fancy:
http://www.aspose.com/Products/Aspose.Word/
And here's another:
www.officewriter.com

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Daniel Walzenbach" <> wrote in message news:...
Hi,

I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed).
The preferable solution would be to have a word template on the server which is populated in the asp.net application and then streamed out to the user.
Also acceptable would be to open a template on the client's computer using automation and fill this file (if this is possible).

Does anybody know how this can be done? Which way would be preferable? Create the file on the server and streaming it out to the user or using automation to populate a file on the client's computer?
I know that it's possible to sent html to excel (via automation) which is then nicely rendered (like in the following example).

<script language="vbscript">
Sub Button1_onclick()
Dim sHTML
sHTML = window.Form1.children("DataGrid1").outerhtml
Dim oXL, oBook
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oXL.Visible = true
oXL.UserControl = true
end sub
</script>

Is there something similar possible with word? If


Thank you a lot for your help!

Daniel Walzenbach
 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      07-29-2004
Hi Daniel,

There are some tech articles discussing on using Automation to process Word
document in .net:

#HOW TO: Automate Word from Visual C# .NET to Create a New Document
http://support.microsoft.com/default.aspx?id=316384

#Microsoft Word Documents from ASP.NET
http://www.codeproject.com/aspnet/wordapplication.asp

However, in ASP.NET Web application, since web application is serverside
application and the Automation is strongly not recommended. And it'll cause
many unexpected issues which may occur randomly. Here is the kb article
mentioned the concerns:

#INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default...b;EN-US;257757

In addition, I still recommend that you consider some other means to
generate word document such as transfer XML document or other components if
you feel appropriate. And here is another kb article discussing use XSL
TRANSFORM to generate word document;

#HOW TO: Use ASP.NET or Visual Basic.NET to Transform XML To Rich Text
Format (RTF) For Microsoft Word 2002
http://support.microsoft.com/default...b;en-us;311461

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      07-29-2004
For that kind of functionality in a web application I'd have to recommend one of the 3rd party products I mentioned. They both support your requirements.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Daniel Walzenbach" <> wrote in message news:...
Steve,



Thank you for your immediate answer. Could you please tell me what I would have to do if I wanted to use automation and be able to access some fields within a template? How would I have to declare those fields and how could they be accessed?



Thank you!

Daniel

"Steve C. Orr [MVP, MCSD]" <> schrieb im Newsbeitrag news:...
This article demonstrates a number of techniques for generating Excel and Word documents.
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

Here's a good 3rd party product you could use if you need to get really fancy:
http://www.aspose.com/Products/Aspose.Word/
And here's another:
www.officewriter.com

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Daniel Walzenbach" <> wrote in message news:...
Hi,

I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed).
The preferable solution would be to have a word template on the server which is populated in the asp.net application and then streamed out to the user.
Also acceptable would be to open a template on the client's computer using automation and fill this file (if this is possible).

Does anybody know how this can be done? Which way would be preferable? Create the file on the server and streaming it out to the user or using automation to populate a file on the client's computer?
I know that it's possible to sent html to excel (via automation) which is then nicely rendered (like in the following example).

<script language="vbscript">
Sub Button1_onclick()
Dim sHTML
sHTML = window.Form1.children("DataGrid1").outerhtml
Dim oXL, oBook
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oXL.Visible = true
oXL.UserControl = true
end sub
</script>

Is there something similar possible with word? If


Thank you a lot for your help!

Daniel Walzenbach
 
Reply With Quote
 
Daniel Walzenbach
Guest
Posts: n/a
 
      07-30-2004
All right,

Thank you Steve!
"Steve C. Orr [MVP, MCSD]" <> schrieb im Newsbeitrag news:O3$...
For that kind of functionality in a web application I'd have to recommend one of the 3rd party products I mentioned. They both support your requirements.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Daniel Walzenbach" <> wrote in message news:...
Steve,



Thank you for your immediate answer. Could you please tell me what I would have to do if I wanted to use automation and be able to access some fields within a template? How would I have to declare those fields and how could they be accessed?



Thank you!

Daniel

"Steve C. Orr [MVP, MCSD]" <> schrieb im Newsbeitrag news:...
This article demonstrates a number of techniques for generating Excel and Word documents.
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

Here's a good 3rd party product you could use if you need to get really fancy:
http://www.aspose.com/Products/Aspose.Word/
And here's another:
www.officewriter.com

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Daniel Walzenbach" <> wrote in message news:...
Hi,

I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed).
The preferable solution would be to have a word template on the server which is populated in the asp.net application and then streamed out to the user.
Also acceptable would be to open a template on the client's computer using automation and fill this file (if this is possible).

Does anybody know how this can be done? Which way would be preferable? Create the file on the server and streaming it out to the user or using automation to populate a file on the client's computer?
I know that it's possible to sent html to excel (via automation) which is then nicely rendered (like in the following example).

<script language="vbscript">
Sub Button1_onclick()
Dim sHTML
sHTML = window.Form1.children("DataGrid1").outerhtml
Dim oXL, oBook
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oXL.Visible = true
oXL.UserControl = true
end sub
</script>

Is there something similar possible with word? If


Thank you a lot for your help!

Daniel Walzenbach
 
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
Populate Word template from ASP GwenP ASP General 3 05-06-2009 04:24 PM
what is the different between byte stream and character stream? dolphin Java 6 03-18-2007 01:58 PM
How to GET multi-word input from a *file* stream as opposed to a *console* stream? sherifffruitfly@gmail.com C++ 9 04-27-2006 04:14 PM
Using values within arrays within a hash to gsub into an input word... Abe Ruby 2 04-15-2006 08:16 PM
Populate a popup window with clickable records from an Access DB and upon clicking, populate a selectbox on the original webpage with the clicked record Enjoy Life ASP General 2 02-23-2005 10:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57