|
 |
|
Dev Articles Community Forums
> Programming
> ASP Development
|
how to create a .doc file using ASP
Discuss how to create a .doc file using ASP in the ASP Development forum on Dev Articles. how to create a .doc file using ASP ASP Development forum discussing your ASP or Visual Basic problems, solutions and code posts. Active Server Pages help you create dynamic websites using powerful scripting technologies.
|
|
 |
|
|
|

Dev Articles Community Forums Sponsor:
|
|

February 21st, 2003, 09:12 PM
|
Contributing User
|
|
Join Date: Feb 2003
Posts: 48
Time spent in forums: 11 m 59 sec
Reputation Power: 16
|
|
how to create a .doc file using ASP
i want to know that how can i generate a report using ASP.
wat i mean is that ive created an intranet application, and to take the printout of the randomly generated output i simply use window.print() function of javascript but that thing has many disadvantages.
how can i create a .doc file of that randomly generated output, as taking printouts of .doc (MS-Word) file wud be really convenient.
please help me, and thanx in advance
Sumeet
|

February 21st, 2003, 11:54 PM
|
 |
May contain nuts.
|
|
Join Date: Aug 2002
Posts: 2,056
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
|
|
one way of doing it would be to set the content-type to MS Word... from memory it's something like "application/msword" - note that you'll need MS Word installed on the client's machine viewing the page.
here's how to do it in ASP: http://www.w3schools.com/asp/prop_contenttype.asp
|

February 22nd, 2003, 01:27 AM
|
Contributing User
|
|
Join Date: Feb 2003
Posts: 48
Time spent in forums: 11 m 59 sec
Reputation Power: 16
|
|
thnx stumpy
well thnx stumy that did worked, but the thing is i want the explorer to open with ms-word application, and that word application should already have pre-defined header & footer (like company's logo etc)
is it possible?
please try to solve my problem
Regards
Sumeet
|

February 22nd, 2003, 01:51 AM
|
 |
May contain nuts.
|
|
Join Date: Aug 2002
Posts: 2,056
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
|
|
Last edited by stumpy : February 22nd, 2003 at 01:54 AM.
|

January 29th, 2004, 06:24 AM
|
Registered User
|
|
Join Date: Jan 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
You can Create a header and a footer for Word Conversions
You need to create a header/footer file, add the lines bellow to the STYLES code section, and set a <DIV id=section1>
/* Page Definitions */
@page
{mso-footnote-separator:url("<%=Application("ServerPath")%>header.htm") fs;
mso-footnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") fcs;
mso-endnote-separator:url("<%=Application("ServerPath")%>header.htm") es;
mso-endnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") ecs;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-header:url("<%=Application("ServerPath")%>header.htm") h1;
mso-footer:url("<%=Application("ServerPath")%>header.htm") f1;
mso-paper-source:0;
mso-gutter-direction:rtl;}
div.Section1
{page:Section1;}
|

February 5th, 2004, 12:45 AM
|
Registered User
|
|
Join Date: Feb 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Can you please elaborate?
Could you please give the complete set of code using your below given code, which will generate a Word Document?
I believe that would be most useful. Thanks.
Quote:
Originally Posted by Sagi_e
You need to create a header/footer file, add the lines bellow to the STYLES code section, and set a <DIV id=section1>
/* Page Definitions */
@page
{mso-footnote-separator:url("<%=Application("ServerPath")%>header.htm") fs;
mso-footnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") fcs;
mso-endnote-separator:url("<%=Application("ServerPath")%>header.htm") es;
mso-endnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") ecs;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-header:url("<%=Application("ServerPath")%>header.htm") h1;
mso-footer:url("<%=Application("ServerPath")%>header.htm") f1;
mso-paper-source:0;
mso-gutter-direction:rtl;}
div.Section1
{page:Section1;}
|
|

February 5th, 2004, 04:02 AM
|
Contributing User
|
|
Join Date: Feb 2003
Posts: 48
Time spent in forums: 11 m 59 sec
Reputation Power: 16
|
|
Dear Sagi,
i agree with jayes, actually i appreciate your code but still i cud'nt understand & implement the same on my application, hope you elaborate more
rgds
Sumeet
|

February 5th, 2004, 09:34 PM
|
Contributing User
|
|
Join Date: Feb 2003
Posts: 48
Time spent in forums: 11 m 59 sec
Reputation Power: 16
|
|
Dear Members,
one more problem that i face is this
when i use application/msword, the required page opens in the explorer window but without word's standard & formating toolbar (for this i have to manually active the said toolbars).
any addition in the script i can do to pre-activate the menus so that users dont have to do the same
rgds
Sumeet
|

February 6th, 2004, 12:24 AM
|
 |
May contain nuts.
|
|
Join Date: Aug 2002
Posts: 2,056
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
|
|
I just wrote this today for a client of mine who wants a report generated in Excel. Put this code in a new file.
Code:
Response.CacheControl = "no-cache"
Response.Expires = -1
Response.AddHeader "Pragma", "no-cache"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=yourfilenamehere.xls"
See where it says "attachment". That will open force a "save as" dialog box. If you change that to "inline", the document will be loaded inside the browser, if possible (in IE anyways... won't work for more secure browsers)
|

February 6th, 2004, 03:25 AM
|
Contributing User
|
|
Join Date: Feb 2003
Posts: 48
Time spent in forums: 11 m 59 sec
Reputation Power: 16
|
|
the above solution was for puttin customised headers for your report, but still i cannot open by default the standard & formatting toolbar when the browser window loads
i have to open the same manually any solution???
|

March 10th, 2004, 04:00 AM
|
Registered User
|
|
Join Date: Mar 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
missing the idea
I think people are missing the main point of the original question. That is how can you dynamically create a word file...i.e. create a word file from your webpage with different information each time, and then mabye display that file in the browser.
|

March 10th, 2004, 05:46 AM
|
 |
May contain nuts.
|
|
Join Date: Aug 2002
Posts: 2,056
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
|
|
Erm - did you read the 2nd post and 9th posts - they explain some of the basics about generating a Word file on the fly. It's really quite simple.
|

April 9th, 2004, 10:04 PM
|
Registered User
|
|
Join Date: Apr 2004
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Semicolon equals problem
I have a related problem I hope someone can help me with.
When I try to use the Office Automation objects, they often call for syntaxes that use :=
For example, to print, you need to use
wrdApp.PrintOut Background:=True
which works fine usually, but in an .aspx document, it does not take. Is there a "workaround syntax" for these types of commands?
Any help would be appreciated!
Thank you.
|

August 24th, 2004, 01:23 PM
|
Registered User
|
|
Join Date: Aug 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Re: I have a related problem I hope someone can help me with
Hi SomewhatShrewd,
I have the same question (please see: http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21104413.html).
So, were you ever able to get an answer for this?
Thanks,
Raj
Quote:
Originally Posted by SomewhatShrewd
I have a related problem I hope someone can help me with.
When I try to use the Office Automation objects, they often call for syntaxes that use :=
For example, to print, you need to use
wrdApp.PrintOut Background:=True
which works fine usually, but in an .aspx document, it does not take. Is there a "workaround syntax" for these types of commands?
Any help would be appreciated!
Thank you.
|
|

June 23rd, 2005, 03:38 PM
|
Registered User
|
|
Join Date: Jun 2005
Posts: 1
Time spent in forums: 6 m 16 sec
Reputation Power: 0
|
|
Quote:
Originally Posted by Sagi_e
You need to create a header/footer file, add the lines bellow to the STYLES code section, and set a <DIV id=section1>
/* Page Definitions */
@page
{mso-footnote-separator:url("<%=Application("ServerPath")%>header.htm") fs;
mso-footnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") fcs;
mso-endnote-separator:url("<%=Application("ServerPath")%>header.htm") es;
mso-endnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") ecs;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-header:url("<%=Application("ServerPath")%>header.htm") h1;
mso-footer:url("<%=Application("ServerPath")%>header.htm") f1;
mso-paper-source:0;
mso-gutter-direction:rtl;}
div.Section1
{page:Section1;}
|
I was having trouble with my margins automatically starting at 1.25 inches... If i tried to set the margins, it only added to them. Ex: If i tried to set the margin to be .25 in, it would become 1.5 in. I tried negative margins but the margin lines would go through text and it was unreadable. I finally i changed the page size.
I needed the left and right margins to be 1 in instead of 1.25 in. So i increased the page width by .5 in. -- size: 9.0in 11.0in;
|

June 14th, 2006, 05:29 AM
|
Registered User
|
|
Join Date: Jun 2006
Posts: 1
Time spent in forums: 30 m 31 sec
Reputation Power: 0
|
|
Using Headers and Footers
How can I get the Headers and Footers in my exported word document.
I have used the code posted by sagi_e but could not get the result. if any body got the result please update this thread.
|

July 19th, 2006, 11:06 AM
|
Registered User
|
|
Join Date: Jul 2006
Posts: 1
Time spent in forums: 7 m 20 sec
Reputation Power: 0
|
|
headers
Hi,
I am also wondering how to make the header file and attach it to my word doc on export...ANyone figured out that code that was posted?
Cheers
|

September 1st, 2006, 04:31 AM
|
Registered User
|
|
Join Date: Sep 2006
Posts: 1
Time spent in forums: 13 m 45 sec
Reputation Power: 0
|
|
You can Create a header and a footer for Word Conversions
Hi Sagi,
I saw your previous post,
You need to create a header/footer file, add the lines bellow to the STYLES code section, and set a <DIV id=section1>
/* Page Definitions */
@page
{mso-footnote-separator:url("<%=Application("ServerPath")%>header.htm") fs;
mso-footnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") fcs;
mso-endnote-separator:url("<%=Application("ServerPath")%>header.htm") es;
mso-endnote-continuation-separator:url("<%=Application("ServerPath")%>header.htm") ecs;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-header:url("<%=Application("ServerPath")%>header.htm") h1;
mso-footer:url("<%=Application("ServerPath")%>header.htm") f1;
mso-paper-source:0;
mso-gutter-direction:rtl;}
div.Section1
{page:Section1;}
can u please explain where i have to include these codes? give me small example?
Thanks,
Kalees
|
Developer Shed Advertisers and Affiliates
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|