Tuesday, September 18, 2007

XML or EXCEL

Hey Guys!

do you know, MS-Office 2003 supports XML strongly. It is very easy to create Excel by making a small XML file. Let me show you...



<?xml version="1.0"?>
<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Worksheet ss:Name="Sheet1">
<ss:Table>
</ss:Table>
</ss:Worksheet>
</ss:Workbook>



This small code is enough to open the Excel Sheet.

Open a text file in notepad.
Write those lines in it and save as .XLS
Your excel sheet is ready.



------------- ADVANCED --------------


<?xml version="1.0"?>
<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Worksheet ss:Name="Sheet1">
<ss:Table>
<ss:Row>
<ss:Cell>
<ss:Data ss:Type="String">Data Column</ss:Data>
</ss:Cell>
<ss:Cell>
<ss:Data ss:Type="String">Data Column</ss:Data>
</ss:Cell>
<ss:Cell>
<ss:Data ss:Type="String">Data Column</ss:Data>
</ss:Cell>
</ss:Row>
</ss:Table>
</ss:Worksheet>
</ss:Workbook>



The above example will create multiple rows


Following lines will help you re-size your columns as per your choice
<ss:column width="100">
<ss:column width="100">
<ss:column width="100">


Place them after <ss:Table> and before <ss:Row>


Soon, I will also tell how to add styles to your XML based spreadsheet

0 comments: