Xml ed Excel

mercoledì 06 dicembre 2006 - 13.59

franksnet Profilo | Newbie

Ciao,

devo importare un file Excel creato con Office 2003 all'interno di una tabella SQL Server 2005 Express Edition. Ho trovato sul sito la guida su come eseguire l'importazione e utilizzando il file di esempio tutto file perfettamente. Se però provo con un file Xml creato da Excel non va a buon fine, suppongo perchè non viene creato uno schema valido o quantomeno uno schema standard ... mi domando se c'è un modo per far si che Excel usi lo stesso formato usato nell'esempio. Questo è il file generato da Excel chiedendogli di Salvare il file come cartella di lavoro Xml ...

<?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">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<LastAuthor>Francesco</LastAuthor>
<Created>2006-12-06T12:04:07Z</Created>
<Version>11.5606</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>9210</WindowHeight>
<WindowWidth>15195</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>60</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s21">
<Font ss:Bold="1"/>
</Style>
<Style ss:ID="s22">
<Font ss:Bold="1"/>
<Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s23">
<NumberFormat ss:Format="General Date"/>
</Style>
</Styles>
<Worksheet ss:Name="Orders">
<Table ss:ExpandedColumnCount="6" ss:ExpandedRowCount="5" x:FullColumns="1"
x:FullRows="1">
<Column ss:Width="75.75"/>
<Column ss:Width="146.25"/>
<Column ss:Width="137.25"/>
<Column ss:Width="127.5"/>
<Column ss:Width="163.5"/>
<Column ss:Width="157.5"/>
<Row>
<Cell ss:StyleID="s21"><Data ss:Type="String">/ROOT</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">/Customers/#id</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">/Customers/@CompanyName</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">/Customers/@ContactName</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">/Customers/@CustomerID</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">/Customers/Orders/@CustomerID</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">/Customers/Orders/@OrderDate</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
<Cell><Data ss:Type="String">Company1</Data></Cell>
<Cell><Data ss:Type="String">Joe</Data></Cell>
<Cell><Data ss:Type="String">XYZAA</Data></Cell>
<Cell><Data ss:Type="String">XYZAA</Data></Cell>
<Cell ss:StyleID="s23"><Data ss:Type="DateTime">2000-08-25T00:00:00.000</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
<Cell><Data ss:Type="String">Company1</Data></Cell>
<Cell><Data ss:Type="String">Joe</Data></Cell>
<Cell><Data ss:Type="String">XYZAA</Data></Cell>
<Cell><Data ss:Type="String">XYZAA</Data></Cell>
<Cell ss:StyleID="s23"><Data ss:Type="DateTime">2000-10-03T00:00:00.000</Data></Cell>
</Row>
<Row>
<Cell ss:Index="6" ss:StyleID="s23"/>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996"
x:Right="0.78740157499999996" x:Top="0.984251969"/>
</PageSetup>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<VerticalResolution>0</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>3</ActiveRow>
<RangeSelection>R4</RangeSelection>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>


E questo era il file originale:

<?xml version="1.0" ?>
<ROOT>
<Customers CustomerID="XYZAA" ContactName="Joe" CompanyName="Company1">
<Orders CustomerID="XYZAA" OrderDate="2000-08-25T00:00:00"/>
<Orders CustomerID="XYZAA" OrderDate="2000-10-03T00:00:00"/>
</Customers>
<Customers CustomerID="XYZBB" ContactName="Steve" CompanyName="Company2">
<Orders CustomerID="XYZBB" OrderDate="2003-06-12T12:00:00"/>
</Customers>
</ROOT>


Dove sbaglio?!!
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2023
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5