Click here to Skip to main content
15,886,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one XML file with extension .xls.So I can see that file in excel also.
XML
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet">
 <Worksheet ss:Name="Request">
  <Table ss:ExpandedColumnCount="11" ss:ExpandedRowCount="6" x:FullColumns="1"
   x:FullRows="1" ss:StyleID="s62">
<Row ss:AutoFitHeight="0" ss:Height="38.25">
    <Cell ss:StyleID="s82"><Data ss:Type="String">Number</Data><NamedCell
      ss:Name="MARKER_PO_START"/></Cell>
    <Cell ss:StyleID="s82"><Data ss:Type="String">ID</Data></Cell>
    <Cell ss:StyleID="s82"><Data ss:Type="String">Model Number</Data></Cell>
   </Row>
  </Table>
</Worksheet>
<pre lang="xml"><Worksheet ss:Name="Info" ss:Protected="1">
  <Table ss:ExpandedColumnCount="8" ss:ExpandedRowCount="9" x:FullColumns="1"
   x:FullRows="1">
   <Column ss:Width="138"/>
   <Column ss:AutoFitWidth="0" ss:Width="93"/>
   <Column ss:AutoFitWidth="0" ss:Width="89.25"/>
   <Column ss:AutoFitWidth="0" ss:Width="169.5"/>
   <Column ss:AutoFitWidth="0" ss:Width="60"/>
   <Column ss:AutoFitWidth="0" ss:Width="64.5"/>
   <Column ss:AutoFitWidth="0" ss:Width="53.25"/>
   <Column ss:AutoFitWidth="0" ss:Width="70.5"/>
   <Row ss:AutoFitHeight="0" ss:Height="20.25">
    <Cell ss:StyleID="s89"><Data ss:Type="String">Shipment Info:</Data></Cell>
    <Cell ss:StyleID="s90"/>
    <Cell ss:StyleID="s91"/>
    <Cell ss:StyleID="s92"/>
    <Cell ss:StyleID="s92"/>
    <Cell ss:StyleID="s79"/>
    <Cell ss:StyleID="s79"/>
    <Cell ss:StyleID="s79"/>
   </Row>
</Table>
</Worksheet>

</Workbook>

I want to add new Row inside Table element ( inside Request Woksheet) so that I can enter the values for Number,ID etc.And entered values should also be visible when I open this Xml file in Microsoft Excel.Please suggest how to solve this ?
Posted
Updated 27-Mar-22 2:29am
v6
Comments
Jegan Thiyagesan 12-Mar-13 9:01am    
Is this xml file created using a program?
where is the code that is generating this file?

We could help you effectively when you show us what you have tried.
Member 9903998 12-Mar-13 14:01pm    
No,This is downloaded file.I did not use any code to generate it.

1 solution

Use System.IO.Packaging to read existing Excel file and add anything to it. You can find a beautiful example in the link below:
http://msdn.microsoft.com/en-us/library/bb508943.aspx[^]
 
Share this answer
 
Comments
Member 9903998 13-Mar-13 2:46am    
It is already existing XML template.I am not getting any r:id attribute and relation type in my existing file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900