Hello
I have a really strange problem.
I need to read an excel file in order to import it into a database. So far so good.
My problem is when I write in this file (for instance modify a cell) and I save it, I got an error.
It looks really like a bug because there is no reason why it couldn't work.
Does sy have the same problem or have a kind of idea ?
Thx
Yep it seems to come from the data's because I just tried to make this operation with a simple excel file containing just simples values (without any kind of controls or vba or whatever ...)
I will report the problem so
Are you saving overtop of the existing file? Have you tried saving it to a new file? I think that either way this is going to end up requiring our Developer Support team involvement. I'm guessing that this has something to do with the excel file that you're loading - our excel engine may not like some of the data inside of that file. Sounds like a bug..
You can use the support options here - www.infragistics.com/gethelp to contact our support team.
-Tony
yeah exactly.
Here is my code
Dim i As Integer = 22
Page.Response.Write(Worksheet.Rows(i).Cells(5).Value)
Worksheet.Rows(i).Cells(5).Value = "132"
Next
# workbook.Save("myfile.xls")
When I run it, I get an error at this line # and it totaly screws up my "myfile.xls" which after the save becomes unreadable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 14: Worksheet.Rows(i).Cells(5).Value = "132" Line 15: Next Line 16: workbook.Save("C:\Inetpub\wwwroot\testExcelIG\PackagingList_Template_new.xls") Line 17: End Sub Line 18: End Class
[NullReferenceException: Object reference not set to an instance of an object.] Infragistics.Excel.Serialization.EscherRecords.ClientData.Save(WorkbookSerializationManager manager) +201 Infragistics.Excel.Serialization.EscherRecords.EscherRecordContainerBase.Save(WorkbookSerializationManager manager) +142 Infragistics.Excel.Serialization.EscherRecords.EscherRecordContainerBase.Save(WorkbookSerializationManager manager) +142 Infragistics.Excel.Serialization.EscherRecords.EscherRecordContainerBase.Save(WorkbookSerializationManager manager) +142 Infragistics.Excel.Serialization.BiffRecords.MSODRAWINGRecord.Save(WorkbookSerializationManager manager) +57 Infragistics.Excel.Serialization.WorkbookSerializationManager.WriteRecord(BIFFType type) +161 Infragistics.Excel.Serialization.WorkbookSerializationManager.WriteWorksheetRecords(Worksheet worksheet, Boolean hasShapes) +650 Infragistics.Excel.Serialization.WorkbookSerializationManager.Save() +330 Infragistics.Excel.Workbook.SaveHelper(Stream stream) +174 Infragistics.Excel.Workbook.Save(String fileName) +93 _Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\testExcelIG\Default.aspx.vb:16 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
and so after , at the opening of the excel file : File corrupted , data have been lost.
NB : the path is just an example, I know it's not the good way to call the file
Can you give us more details on the error? Is it an unhandled exception? If so, whats the exception and message? A stacktrace could be helpful as well. Also, when you modify the cell and save it - are you referring to inside of the grid?