回复 18楼seasky083的帖子
该bug会在 Spread 8V2 中修复,预计11月左右发布。
当前您可以使用下面代码绕过这个问题:
- protected void Button2_Click(object sender, EventArgs e)
- {
- FpSpread book = new FpSpread();
- this.Form.Controls.Add(book); // This is a bug of Spread that require it's placed in a webpage
- book.OpenExcel(Server.MapPath("tt2.xls"), FarPoint.Excel.ExcelOpenFlags.TruncateEmptyRowsAndColumns);
- foreach (SheetView sheet in book.Sheets)
- {
- var col = sheet.NonEmptyColumnCount;
- var row = sheet.NonEmptyRowCount;
- }
- book.Style.Add(HtmlTextWriterStyle.Display, "none"); // Make it invisible
- // This code is fine
- //FpSpread1.OpenExcel(Server.MapPath("tt2.xls"), FarPoint.Excel.ExcelOpenFlags.TruncateEmptyRowsAndColumns);
- //foreach (SheetView sheet in FpSpread1.Sheets)
- //{
- // var col = sheet.NonEmptyColumnCount;
- // var row = sheet.NonEmptyRowCount;
- //}
- }
复制代码 |