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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:49:46+00:00 2026-05-27T20:49:46+00:00

I’m using an Ajax Web Table to display the data shown in a database/table.

  • 0

I’m using an Ajax Web Table to display the data shown in a database/table. When I export my file into an excel spreadsheet fields after a certain length appear as xxE+XX. So for example if I have the a field with the value 123456789 when exported i would get 12.34E+9.

Is there a way to get around this?

my code is as follows

else if(isset($_GET['export']))
    {
session_start();
        ob_start();
        $this->mysqlConnect();
        header("Content-type: application/vnd.ms-excel"); 
        header("Content-Disposition: attachment; filename=report.xls"); 
        header("Pragma: no-cache"); 
        header("Expires: 0"); 

        $select = "SELECT * FROM customers"; 
        $export = mysql_query($select); 
        $count = mysql_num_fields($export); 
        for ($i = 0; $i < $count; $i++) { 
        $header .= mysql_field_name($export, $i)."\t"; 
        } 
        while($row = mysql_fetch_row($export)) { 
        $line = ''; 
        foreach($row as $value) { 
        if ((!isset($value)) OR ($value == "")) { 
        $value = "\t"; 
        } else { 
        $value = str_replace('"', '""', $value); 
        $value = '"' . $value . '"' . "\t"; 
        } 
        $line .= $value; 
        } 
        $data .= trim($line)."\n"; 
        } 
        $data = str_replace("\r", "", $data); 
        if ($data == "") { 
        $data = "\n(0) Records Found!\n"; 
        } 
        print "$header\n$data";        
            exit();

All help and feedback is greatly appreciated!

EDIT
phpMyAdmin has the same issue when selecting “csv” or “excel” format. But when Exporting as MS-Excel 2000 it solves the problem. Anyone know what the difference in exporting might be?

  • 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-05-27T20:49:47+00:00Added an answer on May 27, 2026 at 8:49 pm

    I haven’t tested this but I think you can prevent this by specifying the number as a string value. The = sign should let excel know the value is a ‘formula’ and that it is a string like so:

    $value = '="12345678901234567890"';
    

    Using a string value is the only way I know of to get around the exponential notation as Excel prefers to shorten large numbers for display reasons. You can see that the actual value remains intact and can be viewed in the formula bar when a cell is selected even if the display shows an exponent.

    Whether saving it as a string will break numerical formulas/functionality is something I can’t address. It doesn’t seem advisable to me to use a string simply to avoid the exponential display as it is just that: a display. The numeric value is still correct in your data.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the
I have a reasonable size flat file database of text documents mostly saved in
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the

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.