- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: ASP.NET Excel Export
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "ASP.NET Excel Export"
Collapse
-
Will have a play with that. Used that carlosag site before for his charting component which is fairly basic but does a nice job and is also free. The guy obviously knows his stuff!
-
Have a look here. I'm using this (albeit on 1.1) and it works a treat.
http://forums.contractoruk.com/thread6725.html
Leave a comment:
-
Nah, still the same. Cant understand it, it just ignores the data sent to the function and writes the entire page to Excel.
Going to have to look into the XML route instead for this one i think.
Leave a comment:
-
Yes, i am using a master page in this instance, hadnt thought of that one, will give it a go with a non master page'd site and see what happens.
Leave a comment:
-
ASP.NET Excel Export
This is doing my nut in. I've got a simple function that i've used countless times in VS 2003 .net 1.1 projects to export a dataset to Excel.
When i use this function in Visual Web Developer .net 2.0 projects though it exports the whole HTML page to excel, not just the supplied dataset.
The function is:
And is called from the page like: ConvertToExcel(YourDatasetName, Response)Code:Sub ConvertToExcel(ByVal ds As DataSet, ByVal response As HttpResponse) response.Clear() response.Charset = "" 'set the response mime type for excel response.ContentType = "application/vnd.ms-excel" 'create a string writer Dim stringWrite As New System.IO.StringWriter 'create an htmltextwriter which uses the stringwriter Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite) 'instantiate a datagrid Dim dg As New DataGrid 'set the datagrid datasource to the dataset passed in dg.DataSource = ds.Tables(0) 'bind the datagrid dg.DataBind() 'tell the datagrid to render itself to our htmltextwriter dg.RenderControl(htmlWrite) 'all that's left is to output the html response.Write(stringWrite.ToString) HttpContext.Current.ApplicationInstance.CompleteRequest() End Sub
tied to a buttons onclick event (plus code to generate dataset 'YourDatasetName').
Anyone know why this doesnt just export the dataset (it'll also export any text or images on the page that contains the button) or does anyone have a decent alternative .net 2.0 VB example as simple as this one?
Ta.Tags: None
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Leave a comment: