LV
|
| Posted: 06/03/2004, 5:55 AM |
|
I created a List page which allow me to output the its contents to an Excel file, no problem there, I can see the contents in Excel, however for some reasons I can't do any calculation on my numeric fields like sum the column, it seems like all of the numeric fields are treated as TEXT, I've tried to select the column in Excel and try to change it to Numeric but results are the same. I even try to cut and paste the columns to a new page, the numeric fields are still text. If I replace one of the row with a new value, that row is calculated okay. Any idea how to fix it. Thanks in advance for your help.
Here is the code I used to output my List to Excel
Page.EnabledViewState=False
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader("Content-Disposition";"inline;filename=""Report5.xls"")
|
|
|
 |
Anothersledhead
Posts: 44
|
| Posted: 06/03/2004, 2:32 PM |
|
Could you elaborate on where you put this code? I would like to duplicate what you are doing.
|
 |
 |
Rick
Posts: 52
|
| Posted: 06/04/2004, 5:02 AM |
|
I had a similar problem and it turned out to be a space problem.
See http://forums.codecharge.com/posts.php?post_id=22206
If that does not solve it I found several other posts by searching for 'excel space' in the forum search.
Rick
|
 |
 |
LV
|
| Posted: 06/04/2004, 5:52 AM |
|
Rick,
Many thanks, the link you provided gave me a lot of information to work with.
Best Regards, 
|
|
|
 |
LV
|
| Posted: 06/04/2004, 5:57 AM |
|
To: Anothersledhead
You will need to create a page using grid builder to make it easier, do not use any formating as it will fail. You can also create search page so your user can select only the Data they need. On the page event before show the following code:
Page.EnabledViewState=False
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader("Content-Disposition";"inline;filename=""Report5.xls"")
That's all to it when you open the page it will give you option to view it on screen or save to a file. Note: You will need to change the Report5.xls to the name of your report.
Check with Rick provided link for more information on how to fix the numeric columns problem.
|
|
|
 |
RoyBaird
Posts: 115
|
| Posted: 07/19/2004, 12:33 PM |
|
LV, dropped your code into the "Before Show" and no go. Get the irritating "Page has errors and cannot be displayed". I have a report5.xls. Any other hints???
_________________
Roy |
 |
 |
peterr
Posts: 5971
|
| Posted: 07/19/2004, 5:16 PM |
|
Did you use "Before Show" event of the page, or something else?
Also try After Initialize event.
If you see errors please paste the full error message here.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
LV
|
| Posted: 07/20/2004, 6:31 AM |
|
To RoyBaird,
Here is my report Page Event BeforeShow, Note: I used the grid builder wizard to built my report and add the code listed below and it works. You should try to create a new test project using the sample intranet database provided and try the report to see if it works first before apply to it to your project, Goodluck!
'Page Event BeforeShow. Action Custom Code @13-73254650
' -------------------------
' Write your own code here.
' clean up the response.object
response.Clear()
response.Charset = ""
Page.EnableViewState=False
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader("Content-Disposition","inline;filename=""Report4.xls""")
' -------------------------
'End Page Event BeforeShow. Action Custom Code
|
|
|
 |
RoyBaird
Posts: 115
|
| Posted: 07/20/2004, 3:48 PM |
|
I placed the code in as follows:
Function Page_BeforeShow() 'Page_BeforeShow @1-653D685B
'Custom Code @225-73254650
' -------------------------
' Write your own code here.
response.Clear()
response.Charset = ""
Page.EnableViewState=False
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader("Content-Disposition","inline;filename=""Report4.xls""")
' -------------------------
'End Custom Code
I am using ASP with Templates, if that makes a difference. I don't see the same heading as you have. Mine is a "function", not an event. I get this error: Microsoft VBScript compilation error '800a0414'
Cannot use parentheses when calling a Sub
/autobahn/forecast/Global_For_list2_events.asp, line 29
Response.AddHeader("Content-Disposition","inline;filename=""Report4.xls""")
---------------------------------------------------------------------------^
_________________
Roy |
 |
 |
LV
|
| Posted: 07/21/2004, 5:32 AM |
|
To: RoyBaird
The code provided is tested on .NET VB, you should ask support group for the equivalent in ASP, show them the code for faster response. Good luck!
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/22/2004, 1:03 AM |
|
The ASP forum may be even better and could avoid such confusion. And I believe that this was already discussed in ASP forum already.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |