ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   view datagrid report in .xls or .pdf (https://www.excelbanter.com/excel-programming/308462-view-datagrid-report-xls-pdf.html)

scarred wind

view datagrid report in .xls or .pdf
 
Hello all!

I'm currently working on a report using webform in VB.Net for the
company i'm working with.

The layout is something like this:

Header(.inc)

Calendar start ---- Calender end (user choose the date they want to
view the report)

create report button (user click this button after specifying the date
and report is then generate)

Footer(.inc)

------------------------
Output:

The report is generated in datagrid according to the date selected.

Header(.inc)

Calendar start ---- Calendar end

Datagrid (with the data provided from stored procedure, which the user
wanted to see)

Footer(.inc)

------------------------
What i want:

after the report is generated, what i want is to enable the user to view
it in .pdf and/or .xls format, by the click of button.
I know i should/can use CrystalReport for this kind of thing, but i'm
not familiar with CrystalReport, i don't know how it works... If
possible i'd like to do this coding without having to use CrystalReport.


I hope, I've been clear to my problem...

Thank you in advance!
Yours,
syidah

----------------------------------------------------------
when you fear to fail, you fear something that has not yet happened.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

scarred wind

view datagrid report in .xls or .pdf
 
found a solution for this one. i've found a good code for letting the
user view the datagrid in excel format.
i hope this will be a good share for all ^^

'below are the conversion codes from datagrid to excel
If Request.QueryString("bExcel") = "1" Then

'Set the content type to Excel.
Response.ContentType = "application/vnd.ms-excel"

'Remove the charset from the Content-Type header.
Response.Charset = ""

'Turn off the view state.
Me.EnableViewState = False

Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)

'Get the HTML for the control
DataGrid1.RenderControl(hw)

'Write the HTML back to the browser
Response.Write(tw.ToString())

'End the response.
Response.End()

Notes: there are supposed to be two pages for this one.


----------------------------------------------------------
when you fear to fail, you fear something that has not yet happened.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

scarred wind

view datagrid report in .xls or .pdf
 
what i mean is two webforms, one to do the conversion process from the
server, one to return the resulting conversion.

----------------------------------------------------------
when you fear to fail, you fear something that has not yet happened.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 11:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com