Entries Tagged as 'Default'

Basic HTML to Excel Formatting

ColdFusion , CSS , Default , MS Office , Tips and Tricks 13 Comments »

I've come across this before but have never thought to blog about it, simply because it was quite an easy implementation in the end-up.

If you're exporting data from an HTML table to an Excel workbook, then the following will save you some time when trying to get Microsoft Excel to format the data. and display it as you desire.

Using Microsofts own Office XML format, you can style \ format the cell data using "CSS like" syntax.

For example, if you wish to format a date column, you can simply add a style attribute with the content style='mso-number-format:"mm\/dd\/yyyy"'.  This format is pretty self explanatory, but will format a given date in the format "10/01/2011" for 10th January 2011.

<td style="mso-number-format:"mm\/dd\/yyyy">
   
 10/01/2011
</td>

If you're a stickler for seperation, like I am, you can take this further by defining CSS Rules in a stylesheet and specifying the class name in your HTML elements.

Read more...

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds