Vanguard Software
Forecasting & Planning Solutions
Home Products Solutions Services Customers Partners Company
 
Applying science to business management

contents.gifindex.gifprev1.gifnext1.gif

createhtmltable

Format: createhtmltable( data, format, tablestyle, rowstyle, colstyle )

Arguments: [any] data Matrix of data to present as a table

(real) format Optional number format code; default = 0

(text) tablestyle Optional HTML table style codes; default = null

[text] rowstyle Optional list of HTML row style codes; default = null

[text] colstyle Optional list of HTML column style codes; default = null

Returns: (text) HTML formulation of a data table

Description: Createhtmltable generates an HTML table from matrix data. For example, the expression

createhtmltable([[1,2],[3,4]])

will return the text

<table>
<tr><td>1</td><td>3</td></tr>
<tr><td>2</td><td>4</td></tr>
</table>

The expression

dialog(createhtmltable([[1,2],[3,4]]))

will output the HTML text above to display the table

  1  3
2  4

The format argument is used to specify how numeric table items are converted to text. See tostring for a list of format codes.

The tablestyle argument is used to insert HTML format options in the <table> portion of the output text. Similarly, the rowstyle and colstyle arguments are used to insert format options in the <tr> and <td> fields. For example, the expression

createhtmltable([[1,2],[3,4]],0,"width=\"200\"",
"bgcolor=\"#ffffc0\"","align=\"right\"")

will return the text

<table width="200">
<tr bgcolor="#ffffc0"><td align="right">1</td>
<td align="right">3</td></tr>
<tr bgcolor="#ffffc0"><td align="right">2</td>
<td align="right">4</td></tr>
</table>

The rowstyle and colstyle arguments can include lists of values. For example, if rowstyle is

["bgcolor=\"ffffc0\"","bgcolor=\"#ffffff\""]

then row background colors will alternate between yellow (#ffffc0) and white (#ffffff). The first element in the rowstyle list is applied to the first row and the second element to the second row. If there are more than two rows, the list will be repeated (first element to the third row, second element to the fourth, etc.).

If the last element in rowstyle or colstyle is the text "repeat", then only the last element in the style list is repeated. For example, if rowstyle is

["bgcolor=\"ffffc0\"","bgcolor=\"#ffffff\"","repeat"]

then the background color for the first row will be yellow, and all remaining rows will be white.

See Also: parsehtmltable, dialog, tostring

  Demand Planning  |  Financial Forecasting
Forecasting Software  |  Strategic Planning Software  |  Decision Tree Software
Decision Support Software  |  Expert System Software  |  Online Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2011 Vanguard Software Corporation
Print this page   Email this page to a friend