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

Free Support Forum - aspose.com

ImportArray with Mixed Values

I am experimenting with Aspose.Cells for Java before making a purchase. I have about 400 values of random data types that I need to push into a single column. Actually they are pulled from JSON as strings and some of them are blank/empty. What is the best way to load them into a column?

When using the ImportArray method (of stings) I am not getting what I expect. The values do not go in with the formatting that the underlying cell has specified. If I open the Excel file after saving it, select some of the problem cells, press “F2”, and then “Enter”, then Excel applies the correct formatting and the underlying calculations are performed. Also, the handling of empty strings is not as expected; the underlying calculations are not performed.

Also, for the empty strings, is there a method to delete a cell’s value?


Thanks for providing us details.

We recommend you to kindly try using Cells.ImportTwoDimensionArray(Object[][]…) instead, it might suit for your requirements. You can use the overloaded method with Boolean convertStringToNumber parameter, or may use the same attribute with TxtLoadOptions opts parameter while importing the txt/CSV file format. By using these methods, those string values will be parsed as its original type, such as, number or DateTime.

However, for empty string values, it requires you to change it to null for your scenario, it is also simple by code, just check every item in the array and if one is empty string then you need to set it to null by yourself.

Hope, this helps a bit.