CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Export Search Results into Excel

Print topic Send  topic

Author Message
Damo

Posts: 22
Posted: 05/21/2013, 9:48 AM

Hi,

I have been reading many threads on how to export the search results into Excel and unfortunately I have not come across a fully explained solution.

At present I have two pages, the first page has a grid with a search form. The second page is a report created by the report builder.

I can search on the first page and the desired results appear in the grid, I then press the export to excel link which opens the second page and a popup appears asking to open or save in excel. Unfortunately all the data appears in excel and not just the search results.

The first page I have set the search properties on the preserve parameters to get and post and my link to excel is <a href="ExportAction.asp?{FormParams}">Export to Excel</a>
and on the second page I have used the following code on the before show event:

Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition","inline; filename=Export.xls"

Could you please let me know what I am doing wrong please?

I assume it must have something with the SQL where parameters on the report page.

Kind regards

Damien
View profile  Send private message
asoaresfil


Posts: 12
Posted: 05/22/2013, 1:10 AM

If I understood your question, you are using the BEFORE SHOW... Forget it... use the setup on OnIntializeView. Just like that:

Function Page_OnInitializeView(Sender) 'Page_OnInitializeView @1-1F930D9C

'Custom Code @134-73254650
' -------------------------
Dim ExportFileName

ExportFileName = "Relatorio_follow_up_pendentes_" & cstr(day(date)) & "_" & cstr(month(date)) & "_" & cstr(year(date)) & ".xls"

'Set Content type to Excel
Response.ContentType="application/vnd.ms-excel"
'Fix IE 5.0-5.5 bug with Content-Disposition=attachment
If InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE 5.5;") OR _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE 5.0;") Then
Response.AddHeader "Content-Disposition", "filename=" & ExportFileName & ";"
Else
Response.AddHeader "Content-Disposition", "attachment; filename=" & ExportFileName & ";"
End if

' -------------------------
'End Custom Code

End Function 'Close Page_OnInitializeView @1-54C34B28

Best regards!

:-)
_________________
Alcides Soares FIlho
c2b@clickstobricks.info
Clicks to Bricks
www.clickstobricks.info

View profile  Send private message
Damo

Posts: 22
Posted: 05/22/2013, 3:04 PM

Hi,

Thanks for the response. However the code provided exports all of the data and not just the search results as desired.

I would be grateful if someone could provide examples of code or a screenshot of how you can export just the search results after the user has queried the database. E.g. There are over 1000 records in the database and after a search between two dates it filters the results down to just over 300.

At present it is exporting all 1000 records and not the 300 as I would like.

Kind regards

Damien
View profile  Send private message
Damo

Posts: 22
Posted: 05/22/2013, 3:04 PM

Hi,

Thanks for the response. However the code provided exports all of the data and not just the search results as desired.

I would be grateful if someone could provide examples of code or a screenshot of how you can export just the search results after the user has queried the database. E.g. There are over 1000 records in the database and after a search between two dates it filters the results down to just over 300.

At present it is exporting all 1000 records and not the 300 as I would like.

Kind regards

Damien
View profile  Send private message
mariya

Posts: 1
Posted: 06/15/2013, 10:32 AM

very nice post i like this forum



pimsleur [url=http://www.pimsleur.me]pimsleur review[/url]
ileatherworld [url=http://www.ileatherworld.com]leather jackets[/url]
test-kings [url=http://www.test-kings.com]Testking[/url]
pass4sure [url=http://www.pass4sure.us]pass 4 sure[/url]
braindumps [url=http://www.braindumps.net]http://www.braindumps.net/ [/url]

_________________
mariya
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.