943,714 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 6864
  • PHP RSS
Sep 2nd, 2008
0

php table export excel worksheet decimal places problem

Expand Post »
Hi -

Can someone please help me?
I have a html table generated by php mysql and have a header to download it to excel.
My problem is, I have this cell/table data that displays .10 in html and when I exported it in excel it displays as 0.1. The proper output should be the ones displayed in html table, and they don't allow me to add a single quote or anything to change the value to string.
Is there anyway special php formatting I need to know before downloading it to excel?
Can anyone guide me on these please?

Thanks,
Pabz
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pabz_sarquilla is offline Offline
6 posts
since May 2006
Sep 4th, 2008
0

Re: php table export excel worksheet decimal places problem

Hi there,
in HTML apply this
html Syntax (Toggle Plain Text)
  1. style="mso-number-format:'\@';"
to cells with your . values or define a CSS class with this style and apply the class.
Last edited by petr.pavel; Sep 4th, 2008 at 5:10 am. Reason: better wording
Reputation Points: 27
Solved Threads: 16
Junior Poster
petr.pavel is offline Offline
116 posts
since Mar 2008
Sep 4th, 2008
0

Re: php table export excel worksheet decimal places problem

Thanks for the reply petr.pavel.
I tried the style that you suggested and it added a single quote before the value. I ask them about this before and they prefer if theres no extra character shown.
Late yesterday, a co worker of mine gave me a link ...http://www.akbkhome.com/blog.php/Vie...cel_again.html. XML to excel is one of the solution but for a quicker way we can use PEAR spreadsheet excel writer..http://pear.php.net/manual/en/packag...cel-writer.php.
Hope this one could help someone else..thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pabz_sarquilla is offline Offline
6 posts
since May 2006
Sep 4th, 2008
0

Re: php table export excel worksheet decimal places problem

I tried the style that you suggested and it added a single quote before the value.
Uhm, I find it difficult to believe that a CSS style could add an apostrophe.
Can you give me an URL with the HTML table you're trying to import? Or can you attach it here?
Petr
Reputation Points: 27
Solved Threads: 16
Junior Poster
petr.pavel is offline Offline
116 posts
since Mar 2008
Sep 4th, 2008
0

Re: php table export excel worksheet decimal places problem

Sorry petr.pavel, my bad.
I forgot to remove the single quote I've added to my code before.
And I tried you suggestion again and it works, Thanks!!!
You have saved me a lot of time...Cheers!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pabz_sarquilla is offline Offline
6 posts
since May 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Looping through the first row of a 2 dimensional array
Next Thread in PHP Forum Timeline: URL Variables PHP4 to PHP5





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC