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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP To Word

Status
Not open for further replies.

debbiezzzzz

IS-IT--Management
Joined
Aug 24, 2007
Messages
58
Location
US
Hello,

I was just wondering if there is a builtin control or method for me to have a user click to convert an ASP generated results form to Microsoft Word?

I.E. We have a data entry form in ASP, when it's finished it generates results. (Like a receipt) We would like to have a button the user clicks that converts this result page to MS Word.

Thanks in Advance!!!

D
 
Either way you need to change the content type of the page. I found this on-line, it is a .NET example.
Code:
Private Function Load() As Page 
    'bind data to data bound controls and do other stuff 
    
    Response.Clear() 
    'this clears the Response of any headers or previous output 
    Response.Buffer = True 
    'make sure that the entire output is rendered simultaneously 
    ''' 
    '''Set content type to MS Excel sheet 
    '''Use "application/msword" for MS Word doc files 
    '''"application/pdf" for PDF files 
    ''' 
    
    Response.ContentType = "application/vnd.ms-excel" 
    Dim stringWriter As New StringWriter() 
    'System.IO namespace should be used 
    Dim htmlTextWriter As New HtmlTextWriter(stringWriter) 
    
    ''' 
    '''Render the entire Page control in the HtmlTextWriter object 
    '''We can render individual controls also, like a DataGrid to be 
    '''exported in custom format (excel, word etc) 
    ''' 
    Me.RenderControl(htmlTextWriter) 
    Response.Write(stringWriter.ToString()) 
    Response.[End]() 
End Function
 
I forgot to clarify, sorry about that. It is an ASP page, but I'm converting everything to .net.

Thanks again,

Deb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top