Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output ASP as Microsoft Word Doc - 2 issues 1

Status
Not open for further replies.

fillup07

Vendor
Apr 1, 2002
62
US
I am currently using this to output a file as a Microsoft Word document

Code:
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "attachment;filename=thefilename.doc"

It works great...

Now I have two issues that I hope will not be too difficult to solve



1) I need a way to make a page-break in Word so that I can create separate pages



2) (the hardest) - I need to output LABELS (like an Avery 8120 or something). How would I go about doing this? I would like to stay away from Components but if that is necessary let me know.



My preference would be to simply output it and have the client computer open it in Word (as my code example above)... but if necessary I am open to the server creating and saving the .doc and then delivering that file. Whatever is easier or necessary...


-Phil
fillup07@hotmail.com
If my post was helpful, please give me a star!
 
I worked on this problem, finnaly i found the solution, the solution is very simple, go to microsoft word, open up the file as you want it, save it in html format and ask word to remember you Word formatting settings, and then you got an html file very easy to edit, just rename it to .doc and you have your word file...

Another solution is with Office 2003, you have a possibility to save word file in xml format, which takes much more place, but it fully editable, and is a full word (2003) file.
 
Yeah... that's what I was playing with last night.
Here's the problem though... I want a page full of different labels...

How should I do it? It looks like it'd be pretty tough to figure out what goes where for each label individually? Would it be possible to actually create a mail-merged document that could be downloaded and have the source online somewhere?
It needs to be very easy for the end-user. Any suggestions?

-Phil
fillup07@hotmail.com
If my post was helpful, please give me a star!
 
Here you have an example of a page with labels readable by word, you have just to play with this html, but you better leave the word descriptions...

BEGINNING::<html xmlns:eek:=&quot;urn:schemas-microsoft-com:eek:ffice:eek:ffice&quot;
xmlns:w=&quot;urn:schemas-microsoft-com:eek:ffice:word&quot;
xmlns=&quot;
<head>
<meta http-equiv=Content-Type content=&quot;text/html; charset=windows-1252&quot;>
<meta name=ProgId content=Word.Document>
<meta name=Generator content=&quot;Microsoft Word 11&quot;>
<meta name=Originator content=&quot;Microsoft Word 11&quot;>
<link rel=File-List href=&quot;Mendel%20Assouline_fichiers/filelist.xml&quot;>
<title>Your Name</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>Mendel</o:Author>
<o:LastAuthor>Mendel</o:LastAuthor>
<o:Revision>1</o:Revision>
<o:TotalTime>0</o:TotalTime>
<o:Created>2003-12-25T20:33:00Z</o:Created>
<o:LastSaved>2003-12-25T20:33:00Z</o:LastSaved>
<o:pages>1</o:pages>
<o:Words>27</o:Words>
<o:Characters>149</o:Characters>
<o:Lines>1</o:Lines>
<o:paragraphs>1</o:paragraphs>
<o:CharactersWithSpaces>175</o:CharactersWithSpaces>
<o:Version>11.5606</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:GrammarState>Clean</w:GrammarState>
<w:HyphenationZone>21</w:HyphenationZone>
<w:punctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState=&quot;false&quot; LatentStyleCount=&quot;156&quot;>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:&quot;&quot;;
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:&quot;Times New Roman&quot;;
mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-bidi-language:AR-SA;}
@page Section1
{size:8.5in 11.0in;
margin:.5in .75in 0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:4;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:&quot;Tableau Normal&quot;;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:&quot;&quot;;
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:&quot;Times New Roman&quot;;
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>

<body lang=FR style='tab-interval:35.4pt'>

<div class=Section1>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0
style='border-collapse:collapse;mso-padding-top-alt:0in;mso-padding-bottom-alt:
0in'>
<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;page-break-inside:avoid;
height:2.0in'>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
</tr>
<tr style='mso-yfti-irow:1;page-break-inside:avoid;height:2.0in'>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
</tr>
<tr style='mso-yfti-irow:2;page-break-inside:avoid;height:2.0in'>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
</tr>
<tr style='mso-yfti-irow:3;page-break-inside:avoid;height:2.0in'>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
</tr>
<tr style='mso-yfti-irow:4;mso-yfti-lastrow:yes;page-break-inside:avoid;
height:2.0in'>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
<td width=336 style='width:3.5in;padding:0in .75pt 0in .75pt;height:2.0in'>
<p class=MsoNormal style='margin-top:0in;margin-right:6.3pt;margin-bottom:
0in;margin-left:6.3pt;margin-bottom:.0001pt'>Your Name</p>
</td>
</tr>
</table>

<p class=MsoNormal><span style='display:none;mso-hide:all'><o:p>&nbsp;</o:p></span></p>

</div>

</body>

</html>
 
Yeah, i'm playing around with that right now. Thanks a lot. I think I am going to do it that way .... without the data-source. Thanks a lot...

Phil

-Phil
fillup07@hotmail.com
If my post was helpful, please give me a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top