1

I need to specify the datatype of the Aspose cells directly from the C# code. When I try to set a value to ‘cell.Type’, I get an error that, ‘Property or indexer ‘Cell.Type’ cannot be assigned to – its is read only’. Is there any other way to do this?

Data and datatypes comes from another service. With each cell, there is a datatype coming in from an external service. I want to set the datatype of the cells from code.

for(int i = 0; i< columnCount; i++)
{
Cell cell = cellSheet.Cells[rowIndex,colIndex];
var dataType = dataTable.Columns[i].DataType.Name;
//How to specify the datatype of each column to the datatype that i get in above line?
}
gunner4evr
  • 79
  • 7
  • 1
    You do not need to specify the data type of the cells in which you are importing source data (DataTable). The data type is automatically set in accordance with the data being inserted. For example, in your DataTable, if you have specified "Int32" data type for a column. When you import that column data, numeric/integer data type would be set for those cells in the worksheet. Moreover, If you need to set the numbers display formatting, you may apply easily, see the document (https://docs.aspose.com/display/cellsnet/Data+Formatting). PS. I am working as Support developer/ Evangelist at Aspose. – Amjad Sahi Jun 01 '20 at 19:20

0 Answers0