CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> .NET

 Output to Excel in .NET (VB)

Print topic Send  topic

Author Message
LV
Posted: 05/14/2004, 8:47 AM

Can someone tell me what is the equivalent code for the .NET (VB) for the line of code below? Which I believe is for ASP.

Response.ContentType = "application/vnd.ms-excel"

I need to output my grid to an Excel file.

Thanks in advance.
LV
Posted: 05/14/2004, 10:51 AM

:-)

For your information, .NET (VB) using the same code to output the grid into Excel according to support group. You will need to add the code in the page before show event. I've tried and it works. Don't forget to remove all formatting, stylesheet or else you may get an error message.
LV
Posted: 05/21/2004, 6:00 AM

FYI,

If you have a large data set you will need to add the Page.EnableViewState=False or else you will get the error message can't read file when you chose to output to Excel.

Here is the complete code and it works for me.

Page.EnableViewState=False
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader("Content-Disposition","inline;filename=""YourReportName.xls""")
bryan kane
Posted: 09/09/2004, 3:34 PM

That's really helpful.

I'm trying to use it in an OnClick command of a button. I'm having a bit of a problem. When codecharge makes an ASP.NET table, it's a repeater. My table shows up in Excel all in one row and includes the search textboxes and the one column that I have of textareas.

Any further suggestions? Am I doing something wrong?

bryan
LV
Posted: 09/10/2004, 10:10 AM

If your report do not required a search feature to limit the return Data then all you have to do is build the page using the Grid builder wizard. Remove any theme, graphics, etc. make the grid as plain as possible. Add the codes in my previous posts and it should work as it has for me.

If your report required a search, then what you need to do is build the search form and the result form separately, when user click on the search oprn the result form with the result for you. These two solutions work for me. Good luck! :-)
Andrei Papay
Posted: 12/01/2004, 11:55 PM

Does anyone knwo how to do this in vb.net .

I cant seem to get it going

Thanks

Andrei
LV
Posted: 12/07/2004, 6:06 AM

The above code is tested in VB.NET, try these steps:
- Create a simple list page
- Remove any formats, buttons from the page
- Insert the code listed below to the page before show event

Page.EnableViewState=False
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader("Content-Disposition","inline;filename=""YourReportName.xls""")

Note: If you have a large data set then you will need to add the Page.EnableViewState=False or else you will get the error message can't read file when you chose to output to Excel.

Good luck!
Heitor
Posted: 01/14/2005, 7:39 AM

Does anyone knwo how To export in csv txt
peterr


Posts: 5971
Posted: 01/14/2005, 9:52 AM

Export to the server or to the client?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Andre Fogelman
Posted: 04/19/2005, 2:04 AM

I have implemented the suggested solution but I am facing a strange problem. After I export to excel I loose all formatting. For example date fields or zip code fields that display correctly in the grid do not maintain there original formattting. Is there a way to specify a colum by colum formatting?
naveed
Posted: 05/22/2005, 2:11 AM

Quote LV:
Can someone tell me what is the equivalent code for the .NET (VB) for the line of code below? Which I believe is for ASP.

Response.ContentType = "application/vnd.ms-excel"

I need to output my grid to an Excel file.

Thanks in advance.
SandP
Posted: 07/13/2005, 12:09 AM

yes i agree
that i export file to excel but in cannot be use in ms-word in mail merge
it error

Test connection failed because of an error in intizlzing provider. External table is not in the expected format.

can u help me
andrefogelman

Posts: 117
Posted: 07/30/2005, 3:55 AM

I had a similar difficulty but the solution is in changing options in MS word and not in the codecharge code.
You have to choose in MS word tools -> options.
Choose the general tab and select confirm conversion on open.
When you do your mailmerge a selection will appear choose DDE conversion and all the formatting you set in Escel will be preserved.
View profile  Send private message
treasacrowe
Posted: 10/12/2005, 8:43 AM

Quote :
Can someone tell me what is the equivalent code for the .NET (VB) for the line of code below? Which I believe is for ASP.

the equivalent code for this in c# is:
Response.ContentType = "application/msexcel";
Treasa

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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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