ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 21st, 2003, 09:12 PM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old February 21st, 2003, 11:54 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #3  
Old February 22nd, 2003, 01:27 AM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #4  
Old February 22nd, 2003, 01:51 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
Sounds like you'll need a component that will let you create/edit MS Word files.

Here's one: http://www.textcontrol.com/

Last edited by stumpy : February 22nd, 2003 at 01:54 AM.

Reply With Quote
  #5  
Old January 29th, 2004, 06:24 AM
Sagi_e Sagi_e is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 Sagi_e User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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;}

Reply With Quote
  #6  
Old February 5th, 2004, 12:45 AM
jayes99 jayes99 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 jayes99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy 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;}

Reply With Quote
  #7  
Old February 5th, 2004, 04:02 AM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #8  
Old February 5th, 2004, 09:34 PM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #9  
Old February 6th, 2004, 12:24 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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)

Reply With Quote
  #10  
Old February 6th, 2004, 03:25 AM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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???

Reply With Quote
  #11  
Old March 10th, 2004, 04:00 AM
micahmicah micahmicah is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 micahmicah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #12  
Old March 10th, 2004, 05:46 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #13  
Old April 9th, 2004, 10:04 PM
SomewhatShrewd SomewhatShrewd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 4 SomewhatShrewd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face 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.

Reply With Quote
  #14  
Old August 24th, 2004, 01:23 PM
rb79 rb79 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 rb79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question 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.

Reply With Quote
  #15  
Old June 23rd, 2005, 03:38 PM
mercer mercer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 1 mercer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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;

Reply With Quote
  #16  
Old June 14th, 2006, 05:29 AM
thotamahesh thotamahesh is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 1 thotamahesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #17  
Old July 19th, 2006, 11:06 AM
caughtsleeping caughtsleeping is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 1 caughtsleeping User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #18  
Old September 1st, 2006, 04:31 AM
kalees kalees is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 1 kalees User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > how to create a .doc file using ASP


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap