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 8520935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:40:23+00:00 2026-06-11T06:40:23+00:00

I got the data from database into my dataset is and then i bind

  • 0

I got the data from database into my dataset is enter image description here and then i bind into my repeater control but its is been showing like “Prince Antony G”. It eliminated the Spaces.
and also i export those data into excel, In excel also the spaces were removed.
I need the show data whatever in my Database. Any idea to solve this problem.

In stack overflow Question box also remove more spaces in between two words

My Excel Coding:

    DataTable dt = new DataTable("Report");
    DataRow dr;
    dt.Columns.Add("Name");   

    for (int i = 0; i < dt_Status.Rows.Count; i++)
    {
        dr = dt.NewRow();

        dr["Name"] ="<pre>"+ dt_Status.Rows[i]["NAME"].ToString() +"</pre>";
        dt.Rows.Add(dr);
    }

    HttpResponse response = HttpContext.Current.Response;

    // first let's clean up the response.object
    response.Clear();
    response.Charset = "";

    // set the response mime type for excel
    response.ContentType = "application/vnd.ms-excel";
    response.AddHeader("Content-Disposition", "attachment;filename=Report.xls");

    // create a string writer
    using (StringWriter sw = new StringWriter())
    {
        using (HtmlTextWriter htw = new HtmlTextWriter(sw))
        {
            // instantiate a datagrid
            DataGrid dg = new DataGrid();
            dg.DataSource = dt;
            dg.DataBind();
            dg.RenderControl(htw);
            response.Write(sw.ToString());
            response.End();
        }
    }

After updating my code i got the excel output as:

enter image description here

I need to display in a single cell.

  • 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-11T06:40:25+00:00Added an answer on June 11, 2026 at 6:40 am

    html doesn’t recognize multiple spaces.

    You you put your data between <pre></pre> tags to say that is is per-formatted.

    Or you could replace the space with &nbsp;. This is a non breaking space character.

    Space is used for formatting your html code, and hence if you have more than one space, it gets wrapped to just one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to import some data from excel into a database . i got
eSo I've got some parsed php data whiched I've fetched from my database and
Imagine I've got a database with lots of data, from which users can search.
I've got raw data streams from image files, like: vector<char> rawData(fileSize); ifstream inFile(image.jpg); inFile.read(&rawData[0]);
I've got a perl script that loads data from an Excel XLS file into
its me again. I got my results to display from the bean list, but
I'm trying to save the data retrieved from the database into a .json. This
I've got a large transaction comprising of getting lots of data from database A,
I have to import data from a CSV file into MySQL database using JSP/Servlet.
I've got a PHP script that deletes old data from a database, reads data

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.