I am getting the following error after opening an Excel file that I just created with a C# program.
Here is the snippet of code. I only write out 1 header row and 10 data rows to test this. I seems to all work and I get a successful execution, but when I open the Excel file it says that there were errors and removed the bad records. I copied most of the code from and existing program, but wrote the following method to cut down on coding each cell. Plus I have I am going to use this with other program and I had to make a method that would handle fields coming in from different SQL scripts.
xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<logFileName>error035480_01.xmllogFileName>
<summary>Errors were detected in file 'X:\BatchOther\NYClaims\NYClaims_20110630.xlsx'summary>
<removedRecord>Removed Records: Cell information from /xl/worksheets/sheet.xml partremovedRecord>
removedRecords>
recoveryLog>
Here is the snippet of code. I only write out 1 header row and 10 data rows to test this. I seems to all work and I get a successful execution, but when I open the Excel file it says that there were errors and removed the bad records. I copied most of the code from and existing program, but wrote the following method to cut down on coding each cell. Plus I have I am going to use this with other program and I had to make a method that would handle fields coming in from different SQL scripts.
//-----------------------------------------------------------------------------------
//Create Cell in spreadsheet
public static void WriteCell(string sb, Row r, Cell c, int col, int row, int sv)
{ PrintLog("sb=" + sb + " r=" + r.ToString() + " c=" + c.ToString() + " col=" + col.ToString()
+ " row=" + row.ToString() + " sv=" + sv.ToString());
if (sv == 1)
c.DataType = CellValues.String;
else
c.DataType = CellValues.Number;
c.CellReference = cols[col] + row.ToString();
c.CellValue = new CellValue(sb);
r.Append(c);
}
I have searched online, but I am not finding a solution. I think it has to do with the message:
Cell information from /xl/worksheets/sheet.xml part
But I do not know how to fix it. I do not know if I put this in the correct forum!
I have attached the portion of code that run the loop that creates the file.
Any help would be greatly appreciated. If anyone needs something else let me know.
arep
Suthish NairPosted Jul 29, 2011, 3:18 PM
A RepaskyPosted Jul 30, 2011, 1:56 PM
I just wish there was something that would point to the problem from the error message when you open the Excel spreadsheet.
I will mark this as a correct answer.
arep
Suthish NairPosted Jul 30, 2011, 3:14 AM
A RepaskyPosted Jul 29, 2011, 3:26 PM
arep