1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Public Shared Sub lireexcel()
Dim oXL As Microsoft.Office.Interop.Excel.Application
Dim oBook As Microsoft.Office.Interop.Excel.Workbook
Dim numFields As Integer
Dim numRows As Integer
Dim curRow As Integer
oXL = New Microsoft.Office.Interop.Excel.Application
oBook = oXL.Workbooks.Open("c:\fichier.xls")
oXL.Visible = False
While Not (oBook.ActiveSheet.Cells(numRows + 1, 1).value Is Nothing)
numRows = numRows + 1
End While
Dim LineIn As String = ""
Dim LineIn2 As String = ""
For curRow = 1 To numRows
LineIn = LineIn & oBook.ActiveSheet.Cells(curRow, 1).Value
LineIn2 = LineIn2 & oBook.ActiveSheet.Cells(curRow, 2).Value
Dim rw As ResourceWriter
rw = New ResourceWriter("c:\test.resx")
rw.AddResource(LineIn, LineIn2)
rw.Generate()
rw.Close()
LineIn = ""
LineIn2 = ""
Next curRow
oBook.Close()
oXL = Nothing
End Sub |
Partager