Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Thu Jul 21, 2011 3:33 pm

Your component works great! I have only one question: how can I set the column width of the .dbf file that I will create from the datagrid?
Right now it automatically sets the column widths to 255 (I opened it in Excel to check).
Thanks in advance!
Gabriel Cánepa
(Villa Mercedes, San Luis, Argentina)

Posts: 8
Joined: Thu Jul 21, 2011 2:59 pm

Thu Jul 21, 2011 3:59 pm

I just found the answer to my own question. Here's what I did:

Spire.DataExport.DBF.DBFExport DBFExport = new Spire.DataExport.DBF.DBFExport();
DBFExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
DBFExport.DataTable = this.dataGridView1.DataSource as DataTable;
DBFExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
DBFExport.AutoFitColWidth = true; //<--I added this line
DBFExport.FileName = "C:\\primdb.dbf";

Hopefully someone else will also find it useful.
Have a great day, ya'll.

Posts: 8
Joined: Thu Jul 21, 2011 2:59 pm

Return to Spire.DataExport