473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

export dataset to excel

Hello,

I have a dataset that has information written in Swedish language, that
means alot of stranch chars like 'Å, Ä, Ö' etc and my code
void Export(datagrid myDataGrid){
Response.Clear();

Response.AddHeader("content-disposition","attachment;filename=FileName.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
myDataGrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();}
this exports a file and replaces the swedish chars to something else like
ö.. Do you have any code sample or idea how to fix that???
--
LZ
Aug 29 '07 #1
5 2554
"Lamis" <La***@discussions.microsoft.comwrote in message
news:77**********************************@microsof t.com...
Response.Charset = "";
Is that not the problem...? Don't you have to specify a value for Charset
here...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 29 '07 #2
hi mark
what should it be???
Response.charst = "ASCII" is not helping?
--
LZ
"Mark Rae [MVP]" wrote:
"Lamis" <La***@discussions.microsoft.comwrote in message
news:77**********************************@microsof t.com...
Response.Charset = "";

Is that not the problem...? Don't you have to specify a value for Charset
here...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 29 '07 #3
On Aug 29, 2:32 pm, Lamis <La...@discussions.microsoft.comwrote:
hi mark
what should it be???
Response.charst = "ASCII" is not helping?
--
LZ

"Mark Rae [MVP]" wrote:
"Lamis" <La...@discussions.microsoft.comwrote in message
news:77**********************************@microsof t.com...
Response.Charset = "";
Is that not the problem...? Don't you have to specify a value for Charset
here...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net- Hide quoted text -

- Show quoted text -
Hej Lamis

try to set encoding

Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252)
Aug 29 '07 #4
"Lamis" <La***@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
hi mark
what should it be???
Response.charst = "ASCII" is not helping?
First, I would try:

Response.Charset = "iso-8859-1";

If that doesn't work, then try adding a ResponseEncoding tag to the @Page
directive e.g.

<%@ Page ContentType="text/html" ResponseEncoding="iso-8859-1">

See here:
http://www.experts-exchange.com/Prog..._21551614.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 29 '07 #5
hi,

Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252) worked
perfectly.. thank's ALOT for your help
--
LZ
"Alexey Smirnov" wrote:
On Aug 29, 2:32 pm, Lamis <La...@discussions.microsoft.comwrote:
hi mark
what should it be???
Response.charst = "ASCII" is not helping?
--
LZ

"Mark Rae [MVP]" wrote:
"Lamis" <La...@discussions.microsoft.comwrote in message
>news:77**********************************@microso ft.com...
Response.Charset = "";
Is that not the problem...? Don't you have to specify a value for Charset
here...?
--
Mark Rae
ASP.NET MVP
>http://www.markrae.net- Hide quoted text -
- Show quoted text -

Hej Lamis

try to set encoding

Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252)
Aug 29 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Maria L. | last post by:
Hi, I need to export the content of a DataGrid (in Windows application in C#), into an Excel spreadsheet. Anyone knows how to do this? Any code snippets would help! thanks a lot, Maria
4
by: Hans [DiaGraphIT] | last post by:
Hi! I want to export a dataset to an excel file. I found following code on the net... ( http://www.codeproject.com/csharp/Export.asp ) Excel.ApplicationClass excel = new ApplicationClass();...
1
by: Kevin Blakeley | last post by:
I know this was just posted but I did not want this message to get lost in the other thread as it's slightly different. Yes I want to export my dataset to excel for my clients, but I don't want...
1
by: ad | last post by:
I used the code below to export a table in a dataset to Excel. It can export only on table at a time. Can export more than on table in a dataset to Excel public static void...
4
by: John Z. | last post by:
I have read numerous articles and postings on various approaches to exporting a DataSet to excel while avoiding the use of automation. I found the most performant approach to be assigning a...
3
by: Scott M. Lyon | last post by:
I'm trying to figure out a way to export data (actually the result of a Stored Procedure call from SQL Server) into a specified Excel spreadsheet format. Currently, I have the data read into a...
3
by: Sachin Salgarkar | last post by:
I have a DataSet that I need to export to Excel. The dataset has multiple tables. I need a way to export the complete dataset to a single Excel Workbook with sheets for each table in the dataset....
1
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of...
4
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a DataSet that I save as XML using the DataSet DataTable's WriteXml method. If I say XmlWriteMode.IgnoreSchema, it shows up great in Excel, but I can not reopen the file in my...
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.