When I try to read a 0 (zero) in a excel file the property "ExcelRangeBase.Text" are empty string and not "0" as expected.<br />I have created (and attached) a simple excel ark, only contains a zero in the first cell. When I run this code - the Assert failed:<br /><br />{code:c#}<br />var filepath = @"C:\temp\TestFile.xlsx";<br />using (ExcelPackage package = new ExcelPackage(new FileInfo(filepath)))<br />{<br /> var worksheet = package.Workbook.Worksheets[1];<br /> ExcelRange wsRow = worksheet.Cells[1, 1, 1, 1];<br /> foreach (ExcelRangeBase cell in wsRow)<br /> Assert.AreEqual("0", cell.Text, "Failed to read 0 (zero) from excel ark"); // This get a error - Text are "" (empty string)<br />}<br />{code:c#}<br /><br />Note: if I set a breakpoint at the Assert method and use VS2010 and look at the properties for variable "cell" in debug mode. Then the "cell.Text" property gets the right value.
↧