Set Column width of .dbf file to be generated

Technical support for Spire.DataExport

Moderators: iceblue support, DataExport, Manager

Set Column width of .dbf file to be generated

Postby gacanepa » 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)
gacanepa
 
Posts: 8
Joined: Thu Jul 21, 2011 2:59 pm

Re: Set Column width of .dbf file to be generated

Postby gacanepa » 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";
DBFExport.SaveToFile();

Hopefully someone else will also find it useful.
Have a great day, ya'll.
gacanepa
 
Posts: 8
Joined: Thu Jul 21, 2011 2:59 pm


Return to Spire.DataExport

Who is online

Users browsing this forum: No registered users and 1 guest