|
 |
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|

September 10th, 2007, 02:51 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Location: Amman, , Jordan.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problem with exporting
Guys I have the following scenario hope anyone can help me with:
custom inquiry pages that generate a sql script, and afterwards i send the script to a page that reads the script, creates the dataset, binds it to a gridview, and exports it to an excel sheet, the data contains some Arabic characters, and when viewing in the gridview it self everything seems fine, but when exporting to excel, all the Arabic data is shown as a garbage! the data is stored in a NVarchar fields and i checked it in my database. I tried changing fonts but it did not work, my only explanation is that I must export to excel using Unicode. so how can I do that?
The following is the code I use in exporting to excel:
************************************************** *******
Response.Clear()Response.AddHeader("content-disposition", "attachment;filename=" & strReportName & ".xls")
Response.Charset = ""
Response.ContentType = "application/vnd.xls"
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As New HtmlTextWriter(stringWrite)
GridView1.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()
************************************************** *********
Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
__________________
Nothing is impossible. The impossible only takes longer. \"Digital Fortress, Dan Brown\"
|

September 11th, 2007, 09:00 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Location: Amman, , Jordan.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Guys I really need an answer here..... i can't find anything online and I tried everything!!
Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
|

September 12th, 2007, 02:01 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Location: Amman, , Jordan.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
tnx a lot man, I viewed the site and I'll try it now
Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
|

September 12th, 2007, 05:07 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Location: Amman, , Jordan.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok after reading the post, I updated my code to :
************************************************** **********
Response.Clear()
Response.Buffer = True
Response.Charset = "" 'You can set UTF-8 or windows-1256 but this will not solve
Response.AddHeader("content-disposition", "attachment;filename=" & strReportName & ".xls")
Response.ContentType = "application/vnd.ms-excel"
Me.EnableViewState = False
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As New HtmlTextWriter(stringWrite)
GridView1.RenderControl(htmlWrite)
'Response.OutputStream.Write(byte(){0xef, 0xbb, 0xbf}, 0, 3)
Response.OutputStream.Write(New Byte() {239, 187, 191}, 0, 3)
Response.Write(stringWrite.ToString())
Response.Flush()
HttpContext.Current.ApplicationInstance.CompleteRe quest()
************************************************** **********
but this code solved my problem in office 2003, but I still have a problem with the office 2000 :s
guys any suggestions?
Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |