Free Support Forum -

ExportDataTableToString has spurious '-' characters

I have this block of code. If I cannot export the cells as a normal formatted table (normally due to the Aspose control being unable to determine the datatype for a column - my clients may have entered text into a numeric column) then i try to export the whole table with string values. The VB.Net code i use is below (export 2nd row down):

allDataTable = cells.ExportDataTable(1, 0, maxRow_i, maxColumn_b)
Catch ex As Exception
allDataTable = cells.ExportDataTableAsString(1, 0, maxRow_i, maxColumn_b)
End Try

Now if a column that is meant to have numeric data in has non-numeric data present then the numeric data get exported as strings with spurious '-' characters e.g. 6253.671 gets exported to a string as "- 6253.671 -".

Why does it do this? Is there any way to fix this?

Is there anyway to determine which column has the problem by inspecting ex?


Which version are you using? Have you tried the latest version at

Could you please post your file here? Thank you.

New DLL seems to have fixed the problem.


Actually I lied. The problem is now limited to negative values. So if you export a negative number to a string you get for example -65.87 => "- 65.87-"

This is quite annoying as later on i need to do an IsNumeric check on the string and thus the value fails.

Any help greatly appreciated.

This problem may be caused by the number format. Do you use some special format string? I didn’t find any problem in your sample file. Could you please post your sample file for this negative number problem? Thank you very much.

The attached file can be only viewed by you and Aspose developers. I will delete them after we solve this problem.

But I still don’t find the problem.Could you please tell me which cell returns the false data? K74,K75 or other cells? They are negative number but I find all returns correct data.

Yes those are the problem cells for me.

Are you using ExportDataTableToString? Using ExportDataTable throws an exception

I’m really sorry but it seems that I have wasted your time.

All of a sudden it has started to give me back the correct values in the dataset. I’ve been working on this all morning and can see no reason for it to just start working now. I’m quite annoyed. Angry

Cheers for your patience.

  1. In column K, there are two different data type: number and string. So ExportDataTable method will throw an exception.

    2. I used ExportDataTableAsString method.

    Dim dt as DataTable= excel.Worksheets[0].Cells.ExportDataTableAsString(1, 0, 387, 12 )

    Cell K75 returns “-0.0088”.

    3. Which locale setting are you using?

Feel free to contact me if you find any problem. Sometime a rebuild or a restart can solve some odd problems.Smile