anandan
Posts: 5
|
Posted: 03/13/2009, 11:27 AM |
|
Dear All,
How to enable Export to Excel option, is it requries manual coding.
Regards
Anand
_________________
Best Regards
Anand |
|
|
mljonzs
Posts: 124
|
Posted: 03/26/2009, 2:33 PM |
|
Create your page in Code charge and remove ALL formatting tags, including any html spaces (& nbsp;)
Then in the Page_AfterInitialize event, add the following code:
' Set up Export to Excel
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition","inline; filename=export.xls"
_________________
What does not begin WITH God, will end in failure!
|
|
|
anandan
Posts: 5
|
Posted: 03/26/2009, 3:21 PM |
|
But the above code will popup the Excel format outpuy, before it showing the HTML format Report .
I want to first see the HTML Report and also I have filters in my report. I want to apply the filter and then need to export to Excel.
Please let me know do you having doubt in my requiremets.
Thanks
Anand
_________________
Best Regards
Anand |
|
|
JimmyCrackedCorn
Posts: 583
|
Posted: 03/26/2009, 7:47 PM |
|
Quote anandan:
How to enable Export to Excel option, is it requries manual coding.
have you looked at this example?
http://examples.codecharge.com/ExamplePack/ExportToExcel/ExportToExcel.php
_________________
Walter Kempees...you are dearly missed. |
|
|
mljonzs
Posts: 124
|
Posted: 03/27/2009, 1:25 PM |
|
Anand,
You need two pages in your CCS project. One for the HTML format you wish to display in the browser. On this page, include a link 'Export to Excel' that links to the export page descirbed above.
The only difference between the two pages is that the export page cannot have any special formatting and it contains the code described above in the Page_AfterInitialize event.
The HTML for the export page should be plain vanilla:
<table>
<tr>
<th>col 1</th>
<th>col 2</th>
</tr>
<tr>
<td>col 1 data</td>
<td>col 2 data</td>
</tr>
</table>
You can still use all the custom code to apply filters, etc but that's it or you might get some unexpected results in Excel.
Does this make sense? If you review the provided sample, I think it will make more sense.
mj
_________________
What does not begin WITH God, will end in failure!
|
|
|
GaryDN
Posts: 34
|
Posted: 03/28/2009, 8:46 AM |
|
I had a page with the export on it and filters. I followed the example and when I filtered the page that was all that exported. I dont remember changing the code from the example.
|
|
|
JimmyCrackedCorn
Posts: 583
|
Posted: 03/28/2009, 2:20 PM |
|
Quote mljonzs:
remove ALL formatting tags, including any html spaces (& nbsp;)
I don't know what you mean by this. I used the CCS example and I didn't have to remove any formatting tags. it just worked!
_________________
Walter Kempees...you are dearly missed. |
|
|
anandan
Posts: 5
|
Posted: 04/20/2009, 12:49 AM |
|
Hi,
I am following the same steps, As they mentioned in the Example pack,
but the problem is, it is not showing up HTML format.
Directly it is prompting to Excel output.
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition","inline; filename=export.xls"
I am using above code in the Custom code ,In Afterinitilization page event.
Regards
Anand
_________________
Best Regards
Anand |
|
|
JimmyCrackedCorn
Posts: 583
|
Posted: 04/20/2009, 10:12 AM |
|
do a report and then, on the report page do the export to excel link
_________________
Walter Kempees...you are dearly missed. |
|
|
zoino
Posts: 3
|
Posted: 10/18/2009, 1:58 AM |
|
This is my idea, or solution, about export to excel problem
1) I insert the custom code in After Initialization page event
if request.querystring("excel")="Y" then
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition","inline; filename=export.xls"
end if
2) I duplicate in a report page the link "printable version" with copy link and past link,
then I rename this with "excel version" and I add another parameter
with source type=Expression, parameter source="Y" and parameter name=excel
Regards
Pasquale Zoino
|
|
|