If File.Exists(FileNameOnly) Then If FileNameOnly.Substring(FileNameOnly.IndexOf(".") + 1) = "txt" Then Using sr As New StreamReader(File.Open(FileNameOnly, FileMode.Open)) Try SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY") Dim ef As ExcelFile = ExcelFile.Load(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) & "\Folder\RGP.xlsx") Dim ws As ExcelWorksheet = ef.Worksheets(0) ws.Cells("A2").Value = TextBox1.Text ws.Cells("A3").Value = Label1.Text ws.Cells("B2").Value = TextBox2.Text Label5.Text = ws.Cells("E1").Value Label6.Text = ws.Cells("E2").Value Label7.Text = ws.Cells("E3").Value Dim dt As DataTable = New DataTable dt.Columns.Add("Test ID", Type.GetType("System.Int32")) Do While sr.Peek() <> -1 dt.Rows.Add(sr.ReadLine) Loop Dim options = New InsertDataTableOptions() options.ColumnHeaders = True options.StartColumn = 1 options.StartRow = 4 ws.InsertDataTable(dt, options) ef.Save(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) & "\Folder\new22.xlsx") Catch ex As Exception End Try End Using End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)