Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem to Export in Excel data format

Reply
Thread Tools

Problem to Export in Excel data format

 
 
Alessandro
Guest
Posts: n/a
 
      06-09-2005

Hi !
I have a table on an aspx page and i want to export its rows into an Excel
File, the script is

Page.Response.Clear()
Page.Response.ClearContent()
Page.Response.ClearHeaders()

Me.TBLexcel.RenderControl(oHTMLWriter)
Page.Response.Write("<html><head></head><body>")
Page.Response.Write(oStringWriter)
Page.Response.Write("</body></html>")
Response.charset="utf-8"
Dim OpenType As String = "attachment"
Page.Response.ContentType = "application/ms-excel"
Page.Response.AddHeader("Content-Disposition", OpenType + ";filename="
+FileName)
Page.Response.End()


But, if i open the file with notepad i find= Members of community Facoltà
di Economia
if i open the file with excel i find= Members of community Facoltà di
Economia


so, there is a problem with encoding, but i don't understand where !


 
Reply With Quote
 
 
 
 
Alessandro
Guest
Posts: n/a
 
      06-09-2005
The complete code:


Dim FileName As String = "Iscritti.xls"
Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter
Dim oHTMLWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
Page.Response.Clear()

Me.TBLexcel.RenderControl(oHTMLWriter)
Dim OpenType As String = "attachment"
Page.Response.ContentType = "application/ms-excel"
Page.Response.AddHeader("Content-Disposition", OpenType + ";filename=" +
FileName)
Page.Response.Write(oStringWriter)
Page.Response.End()


The problem is with object "oStringWriter ",it uses unicode and not UTF-8,
but it's not possible to change this encoding


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel (Default File Type - Excel) =?Utf-8?B?SGVtYW50IFNpcGFoaW1hbGFuaQ==?= ASP .Net 15 05-21-2009 12:01 PM
Export to excel in asp.net using excel template Grey ASP .Net 4 10-17-2007 08:08 AM
Problem with export to excel column format CDonlan ASP .Net 0 06-19-2007 03:24 PM
using Microsoft Excel image for Export to Excel button =?Utf-8?B?U3JpZGhhcg==?= ASP .Net 0 12-09-2005 08:58 PM
Invalid export DLL or export format =?Utf-8?B?RGF2aWQgVmFsbGU=?= ASP .Net 0 10-29-2003 11:46 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57