You want to put a string longer than 32K to CellQ4


#1

I am using the ImportDataTable method to add a DataTable to a worksheet.

If the datatable contains a value who's length is greater then 32K characters I get the error
"You want to put a string longer than 32K to CellQ4"

Is there anyway to have the ImportDataTable method truncate strings greater then 32K so an error is not thrown?

The data is being pulled from an SQL database.


#2

This is a limitation of MS Excel, not Aspose.Cells. MS Excel doesn’t allow you to put a string longer than 32k to a cell.


#3

I understand that this is an Excel limitation. Can Aspose add a feature to automatically truncate strings greater then 32K characters when adding from a datatable?



The DataTable is created from a SELECT statement on a database table.



Right now the only alternative would be for developers to iterate over each row and column in the data table, check the strings length, truncate if necessary and assign the value to a cell. I’m assuming your ImportDataTable method is many times faster then doing this in our code.


#4

We can add a new overloaded ImportDataTable method to automatically truncate too long text. However, I think there are too many ImportDataTables now.


#5

You could also just modify the database query to provide truncated results to the Cells API. Not as clean, but it’s cleaner than iterating the rows yourself.


#6

Yes. I think this approach is better.