I am astonished, we cannot find a simple way to import a workbook or a worksheet into a wingrid. we are working with 2007.3 but we cannot find a way to simple import as we can easily export to excel.
Is it not implemented? do we have to manually import the worksheet data cell by cell???
please, advise
Hi Nicloas,
I took a look at the sample and it looks like this sample is written to just read in any Excel data with no notion of what the resulting data structure should be. Excel doesn't really have any notion of a data type like a DataTable has. So there's no way for a generic sample like this to interpret dates as dates, since Excel just stores dates as doubles.
If you know what the structure of your data should be, then you could create a DataTable with columns that have the appropriate data types and then when you read in the Excel data, you could convert the Excel values into the appropriate type as you go.
For dates, you would use the Infragistics.Excel.CalcEngine.ExcelCalcValue.ExcelDateToDateTime method to convert the value from a double into a DateTime.
Jason, i already test your example, and it work fine but when I receive dates and double values it doesn't work. They are formated to integer!
I looked inside object "cell", but there isn't any properties to resolve it.
Please help with this error.
Thanks!
Nicolas
Try to use Spire.XLS - it is .net excel export/import component that supports importing/exporting to XLS, XLSX, CSV and HTML files.
Yes, it would be much easier if your object model had an API where I could supply a dataset and an XLS file and not have to write all of this iteration garbage.
If I can tell you the structure of how the data in the import file is going to be, then why should I have to implement code to iterate through workbook, worksheets, cells, and rows to create a dataset?
I just had different expectations when reading how the ultraGrid supports excel import, especially since your export API is a 1 liner. This would be like .NET touting how easy it is to work with POP3, when all they have done is abstracted the network communications and none of the MIME parsing.
Hi,
If I understand correctly, what you are asking is exactly what this sample does:
http://download.infragistics.com/users/samplecode/excelio.zip
It uses our Excel library API to read data to or from Excel.
Is there something that is missing that would make this easier?
Thanks for any feedback,
Jason