Note that there are some explanatory texts on larger screens.

plurals
  1. POExporting Data To Multiple Excel Sheets
    primarykey
    data
    text
    <p>I'm Using following code to export my listview to Excelsheet but the problem is i have multiple listviews which i have to export in different sheets in same excel file . . . . .</p> <pre><code>Dim flnameSaveAs As String = System.IO.Path.GetFileName(Main.spath1) 'Save Files name Dim extension As String extension = Path.GetExtension(Main.spath1) Dim file As String = System.IO.Path.GetFileName(Main.spath1) Dim FinenameA As String = System.IO.Path.GetDirectoryName(Main.spath1) Dim savnames As String savnames = file.Substring(0, Len(file) - Len(extension)) Dim ExportSheet As String ExportSheet = deskPath + "\Cel_ID_TimeLine.txt" Dim lvi As ListViewItem Dim sb As New System.Text.StringBuilder Dim sbhd As New System.Text.StringBuilder Dim columns As Integer = lvCidTimeLine.Columns.Count For ixhd As Integer = 0 To lvCidTimeLine.Columns.Count - 1 sbhd.Append(lvCidTimeLine.Columns(ixhd).Text) sbhd.Append(vbTab) Next sb.Append(vbCrLf) For Each lvi In lvCidTimeLine.Items For ix As Integer = 0 To lvi.SubItems.Count - 1 sb.Append(lvi.SubItems(ix).Text) If ix &lt; lvi.SubItems.Count - 1 Then sb.Append(vbTab) Else sb.Append(vbCrLf) End If Next Next Dim sw As New StreamWriter(ExportSheet) sw.Write(sbhd.ToString) sw.Write(sb.ToString) sw.Close() Dim oExcel As Excel.Application ' Create the spreadsheet oExcel = CreateObject("Excel.Application") oExcel.Workbooks.OpenText(ExportSheet, , , , -4142, , True) oExcel.Cells.EntireColumn.AutoFit() oExcel.ActiveWorkbook.SaveAs(savpath + "\" + savnames + ".xls", -4143) oExcel.Quit() oExcel = Nothing </code></pre> <p>So do you have any idea how to add another sheet and export another listview to it ??</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload