Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8793841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:10:27+00:00 2026-06-13T23:10:27+00:00

I have a problem with my function for exporting .xls file from website asp.net

  • 0

I have a problem with my function for exporting .xls file from website asp.net (C#).
It save all <tr> into one string.
Function work nice, but it doesn’t save properly polish chars (Ł, ó, ę – etc).
how can I resolve this ?

Here is my code:

string ExcelExport;
string StringExport;


 (..)

protected void lvUsers_ItemDataBound(object sender, ListViewItemEventArgs e)
{
    if (e.Item is ListViewDataItem)
    {
        (..)

        StringExport = StringExport + string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>", currentUser.name, currentUser.surname, tel, currentUser.email);
    }
}




protected void btnDownloadList_Click(object sender, EventArgs e)
{
    ExcelExport = "<table><tr><td>Name</td><td>Surname</td><td>Telephone</td><td>E-mail</td></tr><tr><td> </td><td> </td><td> </td><td> </td></tr>" + StringExport + "</table>";

    Response.AddHeader("Content-disposition", "attachment; filename=raport.xls");
    Response.Charset = "utf-8";
    Response.ContentType = "application/ms-excel";
    Response.Write(ExcelExport);
    Response.End();

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:10:27+00:00Added an answer on June 13, 2026 at 11:10 pm

    Try using the byte order mark (BOM) as suggested in this similar solution

    protected void btnDownloadList_Click(object sender, EventArgs e)
    {
        ExcelExport = "<table><tr><td>Name</td><td>Surname</td><td>Telephone</td><td>E-mail</td></tr><tr><td> </td><td> </td><td> </td><td> </td></tr>" + StringExport + "</table>";
    
        Response.AddHeader("Content-disposition", "attachment; filename=raport.xls");
        Response.ContentType = "application/ms-excel";
        byte[] BOM = { 0xEF, 0xBB, 0xBF }; // The BOM for UTF-8 encoding.
        Response.BinaryWrite(BOM);
        Response.Write(ExcelExport);
        Response.End();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big problem with exporting my table to Excel file format. Firstly
I have problem with function checking collision. No matter what I do it throws
I have a problem with Jquery function getJSON, the action url does not trigger
I have a problem with a function ( setLayerType(LAYER_TYPE_NONE, null) ) available in api
I have a problem with the function call: [self dismissModalViewControllerAnimated:YES]; In MainViewController, I can
I have problem with passing an argument to my simple function in jQuery: When
I have problem with fancybox. I want to write a function that will run
THIS IS THE FULL SCRIPT http://goo.gl/HoCxk I have a problem with this function: $('.message').click(function(){
I have a problem with my opendir function. if ($handle = opendir($dir)) { echo
I have a problem to create a preprocessor macro function, that concatenates two Strings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.