Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2005, 05:23 AM
Authorized User
 
Join Date: Jan 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating MS Word documents in ASP

I have the following code which works and writes to a simple word temaplate. However, I want to:
1) use a specific template to acheive this, and
2) would like to ensure the content appears in a specific position

The solution to 1 will be good enough.

Thanks in advance.

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

dim quoteTable

quoteTable="<table cellpadding='1' cellspacing='0' wisth='100%'><tr><td colspan='5'><h3 style='padding-left:10px;'>Existing quotes</h3></td></tr>"
quoteTable=quoteTable & "<tr bgcolor='#ADCCE4'><td class='right_text'><strong>Date of quote</strong></td>"
quoteTable=quoteTable & "<td class='right_text'><strong>Quote</strong></td>"
quoteTable=quoteTable & "<td class='right_text'><strong>Item</strong></td>"
quoteTable=quoteTable & "<td class='right_text'><strong>Cost</strong></td>"
quoteTable=quoteTable & "<tr><td class='right_text'>Date of quote</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;1500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>Item</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;1500.00</td>"
quoteTable=quoteTable & "<tr><td class='right_text'>Date of quote</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;1500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>Item</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;1500.00</td>"
quoteTable=quoteTable & "<tr><td class='right_text'>Date of quote</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;1500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>Item</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;1500.00</td>"
quoteTable=quoteTable & "<tr><td class='right_text' colspan='4'>&nbsp;</td></tr>"
quoteTable=quoteTable & "<tr><td class='right_text'><strong>Totals</strong></td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;4500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>&nbsp;</td>"
quoteTable=quoteTable & "<td class='right_text'>&pound;4500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>&nbsp;</td></tr>"

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
     <title>Untitled</title>
     <style type="text/css">

     .BigTitle {
     font-family: Verdana, Sans-Serif;
     font-size: 20pt;
     font-weight: bold;
     color: #004080;
     }

     .UserDetails {
     font-family: Courier New, Monospace;
     font-size: 12pt;
     }
     .right_text {
     font-family: Verdana, Arial, Helvetica, sans-serif;
     font-size: 12px;
     color: #666666;
     line-height: 15px;
     padding-left: 10px;
}
     </style>
</head>

<body>

<span class="BigTitle">Quotes</span>

<span class="UserDetails"><%=quoteTable%></span>

</body>
</html>


 
Old August 11th, 2005, 09:02 AM
Authorized User
 
Join Date: Jan 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just saved the template as a web page, then added my code to the xhtml page generated by word. Headers, footers and images are not included. Is there a .NET way round this?
 
Old April 10th, 2007, 08:10 AM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to krishnanincts
Default

i have to create a word document with header and footer.the text to be displayed is in entered into a text box and button is pressed then word is to be generated.i should not use the msword object. i have to use only xml/xslt.it should be in c#..... can you help me

 
Old April 10th, 2007, 08:12 AM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to krishnanincts
Default

Quote:
quote:Originally posted by Nicky2k
 I just saved the template as a web page, then added my code to the xhtml page generated by word. Headers, footers and images are not included. Is there a .NET way round this?
i have to create a word document with header and footer.the text to be displayed is in entered into a text box and button is pressed then word is to be generated.i should not use the msword object. i have to use only xml/xslt.it should be in c#..... can you help me








Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP and word documents Nicky2k Classic ASP Databases 1 August 11th, 2005 04:11 PM
creating a form in ms word kaly VB How-To 13 August 7th, 2005 09:25 PM
Creating an MS-Word like text editor srotondo Classic ASP Basics 8 October 18th, 2004 06:36 PM
Creating MS Word File at Client Side zaeem Classic ASP Components 1 November 2nd, 2003 07:59 PM
VB App creating an Area Chart in MS Word mbyndas VB How-To 0 September 30th, 2003 08:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.