View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default html markup to specify data type of cells in Excel

Red Ogden wrote:
Many thanks for that Jake.


No problem, Redge.

Just to help you solve problems like this in the future, here are the steps
I took to determine the style needed in this case:

1) formatted column A as text
2) entered number 00012 in cell A1
3) entered number 00012 in cell B1 (changed to 12 when entered)
4) opened the Microsoft Script Editor (Alt+Shift+F11)
5) located the <column that contained 00012
6) saw that the class assigned to that <column is named "xl24"
7) located ".xl24" in the <style block in the page header
8) noticed the "mso-number-format" style and copied it
9) created a new HTML document with a simple table
10) in one <td, set the style attribute to text copied from step 8
11) in that <td, use the value 00012
12) in another <td, use the value 00012
13) save the HTML document
14) open the document with Excel
15) notice that the first cell comes through with leading 0's
and the second doesn't

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]