In Microsoft Excel 2000, formulas and data types are specified in attributes of HTML table elements. These attributes are specific to Excel and have an x namespace character prefix. External references are specified using the SupBook element.
fmla Attribute
bool Attribute
err Attribute
num Attribute
str Attribute
This attribute contains the formula used in a table cell. It contains an equal sign (=) followed by the formula string. The fmla attribute is specified in an HTML TD or TH table element. The element contains the result of the formula, or if formulas are displayed when the Web page is saved, the formula string.
Any Excel function or formula can be specified. English language formulas are converted to A1-style cell references when the page is saved. Range references are based relative to the top left cell of the table (which is considered to be A1) and specified in A1-style.
Example
In the following example, the expense in cell B10 is subtracted from sales in cell A10 to determine the profit in cell C10.
<tr height=17 valign=bottom style='height:12.75pt'>
<td height=17 style='height:12.75pt'>Sales</td>
<td>Expenses</td>
<td>Profit</td>
</tr>
<tr height=17 valign=bottom style='height:12.75pt'>
<td height=17 align=right style='height:12.75pt' x:num>100</td>
<td align=right x:num>85</td>
<td align=right x:num x:fmla="=A10-B10">15</td>
</tr>
The data in the table appears the same regardless of whether the Web browser supports formulas. However, in a browser that supports formulas, if a user changes the value in a cell referenced by the formula, the formula is recalculated.
When using Excel built-in functions, the equal sign (=) must be specified as shown in the following examples.
<td height=17 align=right style='height:12.75pt' x:num x:fmla="=SUM(B2:B5)">10</td>
<td height=17 align=center style='height:12.75pt' x:err="#DIV/0!"
x:fmla="=AVERAGE(D3:D10)">#DIV/0!</td>
Character entities can be specified and are required in some cases. For example, if double or single quotation marks are specified in the function, the " entity for double quotation marks or the ' entity for single marks must be used.
Example
In the next example, two strings are joined.
<td height=17 style='height:12.75pt'
x:fmla="=CONCATENATE("The ", "bicycle")">The bicycle</td>
Attributes are used to specify the data type of a cell in a table created using Microsoft Excel. If the str attribute is specified in the Table element, and if a data type attribute is not specified in the cell element, the default data type is string. If the str attribute is not specified in the Table element, Microsoft Excel determines the data type.
Example
In the following example, the first cell contains the string 12345, and the second cell contains the number 12345.
<td height=17 align=right style='height:12.75pt' x:str>12345</td>
<td height=17 align=right style='height:12.75pt' x:num>12345</td>
The bool attribute specifies that a cell contains a Boolean value. This attribute contains the string constant TRUE or FALSE. The bool attribute is specified in an HTML TD or TH table element. The element contains the string constant TRUE or FALSE, or the localized equivalent string.
Example
In this example, the cell contains the Boolean value TRUE.
<td height=17 align=center style='height:12.75pt' x:bool="TRUE">TRUE</td>
This attribute specifies that a cell contains an error value. It contains one of the following string constants: #DIV/0, #NAME?, #NULL, #NUM, #N/A, #REF!, or #VALUE. The err attribute is specified in an HTML TD or TH table element. The element contains one of the string constants or the localized equivalent string.
Example
This example shows a division by zero error in the cell.
<td height=17 align=center style='height:12.75pt' x:err="#DIV/0!"
x:fmla="=A1/A3">#DIV/0!</td>
The num attribute specifies that a cell contains a number, and it contains the precise value of the cell. If the cell value equals the precise value, the attribute is specified without a value. The num attribute is specified in an HTML TD or TH table element.
Example
In this example, the precise value of the first cell is 12345, and the precise value of the second cell is 12344.6789.
<td height=17 align=right style='height:12.75pt' x:num>12345</td>
<td height=17 class=xl24 align=right style='height:12.75pt'
x:num="12344.6789">12345</td>
The str attribute specifies that a cell contains a string, but it is optional if the str attribute is specified in the Table element. The str attribute is specified in an HTML TD or TH table element.
Example
This example shows a cell containing the string "12345".
<td height=17 align=right style='height:12.75pt' x:str>12345</td>