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.

Tue Oct 30, 2018 2:59 pm

I am using Spire.DataExport.DBF.DBFExport to export a DataTable to a .DBF file. Several columns in the DataTable are columns that only contain values of type INT.

Using C# and .NET 4.5 it seems when I export a column of type INT to a .DBF file the output value is formated as a NUMERIC of 15 digits with 4 decimal point precision. How do I instruct Spire.DataExport.DBF.DBFExport to treat that column as an INT?

Thank you for any assistance in this matter.

-Gwen

Gwennie
 
Posts: 3
Joined: Mon Aug 22, 2016 5:07 pm

Wed Oct 31, 2018 5:33 am

Hello,

Thanks for your inquiry.
After an initial test with the latest Spire.Office Platinum (DLL Only) Version:3.10.3, I didn't reproduce the issue that the INT type was formatted after exporting to .dbf. Attached is my generated .dbf. If you were using an old version, I suggest that you upgrade to the latest version to have a test, if the issue still happens, please provide your code as well as your output .dbf file for our reference.
My testing code:
Code: Select all
private void LoadData_Click(object sender, EventArgs e)
{
    DataTable dt = new DataTable();
    dt.Columns.Add("column1", typeof(int));
    dt.Columns.Add("column2", typeof(int));
    DataRow row = dt.NewRow();
    row[0] = "1000";
    row[1] = "2000";
    dt.Rows.Add(row);

    this.dataGridView1.DataSource = dt;
}
private void ExportToDBF_Click(object sender, EventArgs e)
{
    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.FileName = "result.dbf";
    DBFExport.SaveToFile();
}

Sincerely,
Nina
E-iceblue support team
Attachments
result.zip
(215 Bytes) Downloaded 1251 times
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Tue Nov 06, 2018 11:17 am

Hello,

Greetings from E-iceblue.
How is your issue now?
Thank in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.DataExport