We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Datatable.... only insert value but keep current sheet format

hi, Aspose,
i use following Aspose to populate datatable into a sheet. it works perfectly.
However, i found the format is always ‘text’, even thought it should be ‘numeric’.
when populating a datatable from below method, is it possible to keep original format?

_worksheet.Cells.ImportDataTable(dataTable, true, startCell);

@catalparue26,

You may try to choose some other overloaded methods for the task. For example, see this overloaded method:
https://apireference.aspose.com/cells/net/aspose.cells.cells/importdatatable/methods/2

This is the method Syntax:

public int ImportDataTable(
DataTable dataTable,
bool isFieldNameShown,
int firstRow,
int firstColumn,
bool insertRows,
bool convertStringToNumber
)

In the above method, you may put “true” for the last parameter that will convert possible numeric data (which is stored as string) to numeric type (values).

hi, i do not want Aspose to change the format… I want to insert datatable into our template sheet without changing sheet format. Ideally only insert VALUE not any format. Is it possible to do that?

@catalparue26,

Please create a sample console application (runnable), zip the project and attach it here to reproduce the issue, we will check it soon. Please create dynamic datatable/dataset in code to remove any inter-dependencies for external database or data source, so we could execute the code seamlessly without any error. Also, provide your input file, current output file and your expected output file (you may create the file in MS Excel manually). We will check and help you though.