|
Prompting user when exporting to Excel using response -- Judy --
Hi all, I'm searching for some data in sql and returning the result back to vb.net. Then i'm writing it using stringbuilder and from there i'm writing it to binary stream using response object. I am trying to display a Excel file in a browser, but I am being prompted to save the file instead. I don't want the user to be prompted; I just want the Excel to be displayed. Here is the code: Dim binaryData() As Byte binarydata = GetDataHere() Response.ContentType = "application/ms-excel" Response.BinaryWrite(binaryData) Response.End() Another problem is that i'm not able to make the heading bold or set the width. Please help me with this. I need the solution asap. Thanks and regards, Judy |
|
-- Raj --
Add this line..... Response.ContentType = "application/ms-excel" Response.AddHeader("Content-Disposition", "inline; filename=yourFile.xsl" ); ---> TO STRAIGHT OPEN IN WINDOW OR Response.ContentType = "application/ms-excel" Response.AddHeader("Content-Disposition", "attachment; filename=Report.pdf" ); ---> TO PROMPT USER TO SAVE OR OPEN Raj |
|
-- pavan --
Raj wrote: Add this line..... Response.ContentType = "application/ms-excel" Response.AddHeader("Content-Disposition", "inline; filename=yourFile.xsl" ); ---> TO STRAIGHT OPEN IN WINDOW OR Response.ContentType = "application/ms-excel" Response.AddHeader("Content-Disposition", "attachment; filename=Report.pdf" ); ---> TO PROMPT USER TO SAVE OR OPEN Raj and my doubt is: how to save the data in ms-word in table format and save it in a location means some drive like c:\pp\xxxx.doc and that data is got form front end (c#.net) and the reverse should also happen means if user types the data in ms-word it should reflect in front end also |