php table export excel worksheet decimal places problem

Thread Solved

Join Date: May 2006
Posts: 6
Reputation: pabz_sarquilla is an unknown quantity at this point 
Solved Threads: 0
pabz_sarquilla's Avatar
pabz_sarquilla pabz_sarquilla is offline Offline
Newbie Poster

php table export excel worksheet decimal places problem

 
0
  #1
Sep 2nd, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 100
Reputation: petr.pavel is an unknown quantity at this point 
Solved Threads: 14
petr.pavel's Avatar
petr.pavel petr.pavel is offline Offline
Junior Poster

Re: php table export excel worksheet decimal places problem

 
0
  #2
Sep 4th, 2008
Hi there,
in HTML apply this
  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
Petr 'PePa' Pavel

The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 6
Reputation: pabz_sarquilla is an unknown quantity at this point 
Solved Threads: 0
pabz_sarquilla's Avatar
pabz_sarquilla pabz_sarquilla is offline Offline
Newbie Poster

Re: php table export excel worksheet decimal places problem

 
0
  #3
Sep 4th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 100
Reputation: petr.pavel is an unknown quantity at this point 
Solved Threads: 14
petr.pavel's Avatar
petr.pavel petr.pavel is offline Offline
Junior Poster

Re: php table export excel worksheet decimal places problem

 
0
  #4
Sep 4th, 2008
Originally Posted by pabz_sarquilla View Post
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
Petr 'PePa' Pavel

The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 6
Reputation: pabz_sarquilla is an unknown quantity at this point 
Solved Threads: 0
pabz_sarquilla's Avatar
pabz_sarquilla pabz_sarquilla is offline Offline
Newbie Poster

Re: php table export excel worksheet decimal places problem

 
0
  #5
Sep 4th, 2008
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!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC