Knowledgebase (2417)
Children categories
Why Export Listview to CSV?
CSV file (Comma Separated Values, sometimes also called Comma Delimited) is a specially formatted plain text file which stores spreadsheet or basic database-style information in a very simple format, with one record on each line, and each field within that record separated by a comma. It is often used to exchange data between disparate applications. CSV has become a pseudo standard throughout the industry, even among non-Microsoft platforms because it is used in Microsoft Excel.
CSV files are often used as a simple way to transfer a large volume of spreadsheet or database information between programs, without worrying about special file types. For example, transferring a home-made address book from Excel into a database program such as Filemaker Pro could be done by exporting the file as a CSV from Excel, then importing that CSV into File maker.
How to Export Listview to CSV?
Spire.DataExport for .NET presents an easy solution for exporting Listvie to CSV. Spire.DataExport is a 100% pure .NET component suit for exporting data into MS Excel, MS Word, HTML, XML, PDF, MS Access, DBF, SQL Script, SYLK, DIF, CSV ,MS Clipboard format. Quickly and easily export data from Command, ListView, DataTable components. Save you much time and money by using Spire.DataExport.
Download Spire.DataExport (or Spire.Office) with .NET framework 2.0 (or above) together and use the code below to Export Listview to CSV:
this.txtExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
this.txtExport1.DataFormats.CultureName = "en-us";
this.txtExport1.DataFormats.Currency = "c";
this.txtExport1.DataFormats.DateTime = "yyyy-M-d H:mm";
this.txtExport1.DataFormats.Float = "g";
this.txtExport1.DataFormats.Integer = "g";
this.txtExport1.DataFormats.Time = "H:mm";
this.txtExport1.DataEncoding = Spire.DataExport.Common.EncodingType.ASCII;
this.txtExport1.DataSource = ExportSource.ListView;
this.txtExport1.ListView = this.ListView1
txtExport1.ExportType = TextExportType.CSV;
txtExport1.FileName = "sample.csv";
txtExport1.SaveToFile();
Me.txtExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
Me.txtExport1.DataFormats.CultureName = "en-us"
Me.txtExport1.DataFormats.Currency = "c"
Me.txtExport1.DataFormats.DateTime = "yyyy-M-d H:mm"
Me.txtExport1.DataFormats.Float = "g"
Me.txtExport1.DataFormats.Integer = "g"
Me.txtExport1.DataFormats.Time = "H:mm"
Me.txtExport1.DataEncoding = Spire.DataExport.Common.EncodingType.ASCII
Me.txtExport1.DataSource = Common.ExportSource.ListView
Me.txtExport1.ListView = Me.ListView1
txtExport1.ExportType = TextExportType.CSV
txtExport1.FileName = "sample.csv"
txtExport1.SaveToFile()
Why Export Listview to Office OpenXML?
Office OpenXML has its own advantages. Office OpenXML, or Extensible Markup Language is a set of rules for encoding documents in machine-readable form. The real power of Office OpenXML comes from the fact that with Office OpenXML, not only can you define your own set of tags, but the rules specified by those tags need not be limited to formatting rules. And the most benefit of Office OpenXML is that because you are writing your own markup language, you are not restricted to a limited set of tags defined by proprietary vendors. Furthermore, Office OpenXML allows you to define all sorts of tags with all sorts of rules, such as tags representing business rules or tags representing data description or data relationships.
How to Export Listview to Office OpenXML?
As a professional and powerful .NET component suit for data exporting, Spire.DataExport for .NET can export data from Database to MS Excel,MS Word, HTML, Office OpenXML, PDF, MS Access, DBF, SQL Script, SYLK, DIF, CSV ,MS Clipboard format and of course enable to export ListView to Office OpenXML.
Spire.DataExport for .NET offers an easy solution on Exporting listview to Office OpenXML. Download Spire.DataExport (or Spire.Office) with .NET framework 2.0 (or above) together and use the code below to Export Listview to Office OpenXML:
this.xmlExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
this.xmlExport1.DataFormats.CultureName = "zh-CN";
this.xmlExport1.DataFormats.Currency = "c";
this.xmlExport1.DataFormats.DateTime = "yyyy-M-d H:mm";
this.xmlExport1.DataFormats.Float = "g";
this.xmlExport1.DataFormats.Integer = "g";
this.xmlExport1.DataFormats.Time = "H:mm";
this.xmlExport1.FileName = "sample.xml";
this.xmlExport1.DataSource = Common.ExportSource.ListView;
this.xmlExport1.ListView = this.listView1;
oleDbConnection1.Open();
try{
xmlExport1.SaveToFile();
}
Finally
{
oleDbConnection1.Close();
}
Me.xmlExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
Me.xmlExport1.DataFormats.CultureName = "zh-CN"
Me.xmlExport1.DataFormats.Currency = "c"
Me.xmlExport1.DataFormats.DateTime = "yyyy-M-d H:mm"
Me.xmlExport1.DataFormats.Float = "g"
Me.xmlExport1.DataFormats.Integer = "g"
Me.xmlExport1.DataFormats.Time = "H:mm"
Me.xmlExport1.FileName = "sample.xml"
Me.xmlExport1.DataSource = Common.ExportSource.ListView
Me.xmlExport1.ListView = Me.listView1
oleDbConnection1.Open()
Try
xmlExport1.SaveToFile()
Finally
Me.oleDbConnection1.Close()
End Try
Why Export Listview to RTF?
RTF (Rich Text Format) is one of three core file formats which Microsoft supports natively along with DOC and DOCX. It's a cross-platform file extension supported by almost all word processors regardless of operating system. RTF word processing files are typically smaller, safer and can be used across a variety of operating systems. Main advantages of RTF:
- File Transparency
- No Risk of Viruses
- Smaller File Size for Text Documents
How to Export Listview to RTF?
Spire.DataExport for .NET as a professional .NET component suit for data exporting can easily help to export Listview to RTF. Download Spire.DataExport (or Spire.Office) with .NET framework 2.0 (or above) together and use the code below to Export Listview to RTF:
this.rtfExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
this.rtfExport1.DataFormats.CultureName = "en-us";
this.rtfExport1.DataFormats.Currency = "c";
this.rtfExport1.DataFormats.DateTime = "yyyy-M-d H:mm";
this.rtfExport1.DataFormats.Float = "g";
this.rtfExport1.DataFormats.Integer = "g";
this.rtfExport1.DataFormats.Time = "H:mm";
this.rtfExport1.FileName = "sample.doc";
this.rtfExport1.RTFOptions.DataStyle.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
this.rtfExport1.RTFOptions.FooterStyle.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
this.rtfExport1.RTFOptions.HeaderStyle.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
this.rtfExport1.RTFOptions.TitleStyle.Alignment = Spire.DataExport.RTF.RtfTextAlignment.Center;
this.rtfExport1.RTFOptions.TitleStyle.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold);
this.rtfExport1.DataSource = ExportSource.ListView;
this.rtfExport1.ListView = this.ListView1
rtfExport1.SaveToFile();
Me.rtfExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
Me.rtfExport1.DataFormats.CultureName = "en-us"
Me.rtfExport1.DataFormats.Currency = "c"
Me.rtfExport1.DataFormats.DateTime = "yyyy-M-d H:mm"
Me.rtfExport1.DataFormats.Float = "g"
Me.rtfExport1.DataFormats.Integer = "g"
Me.rtfExport1.DataFormats.Time = "H:mm"
Me.rtfExport1.FileName = "sample.doc"
Me.rtfExport1.RTFOptions.DataStyle.Font = New System.Drawing.Font("Arial", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World)
Me.rtfExport1.RTFOptions.FooterStyle.Font = New System.Drawing.Font("Arial", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World)
Me.rtfExport1.RTFOptions.HeaderStyle.Font = New System.Drawing.Font("Arial", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World)
Me.rtfExport1.RTFOptions.TitleStyle.Alignment = Spire.DataExport.RTF.RtfTextAlignment.Center
Me.rtfExport1.RTFOptions.TitleStyle.Font = New System.Drawing.Font("Arial", 10.0!, System.Drawing.FontStyle.Bold)
Me.rtfExport1.DataSource = Common.ExportSource.ListView
Me.cellExport1.ListView = Me.ListView1
Me.cellExport1.SaveToFile()