I want to create the Excel that's have a drop-down list.

Joined
Mar 13, 2008
Messages
1
Reaction score
0
Hi


I want the Excel to have a drop-down list.
I have a string of xml like this:

xml.txt

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:eek:ffice:spreadsheet"
xmlns: o ="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns: x ="urn:schemas-microsoft-com:eek:ffice:excel"
xmlns:ss ="urn:schemas-microsoft-com:eek:ffice:spreadsheet"
xmlns:html ="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:eek:ffice:eek:ffice">
<Author>Mee</Author>
<LastAuthor>Mee</LastAuthor>
<Created>2008-05-07T06:18:28Z</Created>
<Company>Ram</Company>
<Version>11.5606</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:eek:ffice:excel">
<WindowHeight>8700</WindowHeight>
<WindowWidth>12315</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>120</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font x:CharSet="222"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Names>
<NamedRange ss:Name="x" ss:RefersTo="=Sheet2!R1C1:R2C1"/>
</Names>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
x:FullRows="1">
<Row>
<Cell><Data ss:Type="String">data</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:eek:ffice:excel">
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>2</ActiveRow>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
<DataValidation xmlns="urn:schemas-microsoft-com:eek:ffice:excel">
<Range>R2C1</Range>
<Type>List</Type>
<Value>x</Value>
</DataValidation>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="2" x:FullColumns="1"
x:FullRows="1">
<Row>
<Cell><Data ss:Type="Number">1</Data><NamedCell ss:Name="x"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">2</Data><NamedCell ss:Name="x"/></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:eek:ffice:excel">
<Panes>
<Pane>
<Number>3</Number>
<RangeSelection>R1C1:R2C1</RangeSelection>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>

I want to convert this string to excel(*.xls) .
I try this :


f = New FileInfo("c:\test.xls")
f.Delete()
s = f.CreateText

s.WriteLine('string from xml.txt')
s.Close()





This code can generate the excel file but when i import excel's data
by this code:

Dim ds As New DataSet
Dim Olecn As OleDb.OleDbConnection
Dim da As OleDb.OleDbDataAdapter
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & FilePath & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""
Olecn = New OleDb.OleDbConnection(strConn)
Olecn.Open()
da = New OleDb.OleDbDataAdapter("SELECT * FROM [" + SheetName + "$]" ), strConn)
Try
da.Fill(ds)
Catch

Finally
Olecn.Close()
End Try
Return ds


This not works.
I can't import data that create from this excel.
I don't know why .
Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top