views:

467

answers:

1

Hi.. if I export the below xml to excel 2007...i am able to get the excel sheet correctly.

<Workbook>
<Worksheet >
<MyXml>
    <New A="111" B="222" />
</MyXml>
<MyXml>
    <New A="111" B="222" />
</MyXml>
</Worksheet>
</Workbook>

But I need a workbook with more than one worksheet...How do i specify the xml in this case ?

+2  A: 

Try this:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40"&gt;
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <ActiveSheet>2</ActiveSheet>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="1" x:FullColumns="1"
   x:FullRows="1" ss:DefaultRowHeight="15">
   <Row>
    <Cell><Data ss:Type="Number">11</Data></Cell>
    <Cell><Data ss:Type="Number">22</Data></Cell>
   </Row>
  </Table>
 </Worksheet>
 <Worksheet ss:Name="Sheet2">
  <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="1" x:FullColumns="1"
   x:FullRows="1" ss:DefaultRowHeight="15">
   <Row>
    <Cell><Data ss:Type="Number">11</Data></Cell>
    <Cell><Data ss:Type="Number">22</Data></Cell>
   </Row>
  </Table>
 </Worksheet>

For more help you can take a look at this.

Finally, you can manually create an excel workbook and export it to XML so that you can examine the XML's format.

Dana
ThanksssssssssssssssssssssssssssssssssssssAlottttttttttttttttttttttttttttttttttttttttttttttt...This was the answer which i am waiting for .....Thanks lot....God bless you
anish mohan