回复 9楼wangwuliSpread的帖子
只导入含有数据的Excel内容:
- string f;
- f = "C:\\savedinexcel.xls";
- System.IO.FileStream s = new System.IO.FileStream(f, IO.FileMode.Open, IO.FileAccess.Read);
- FpSpread1.OpenExcel(s, FarPoint.Excel.ExcelOpenFlags.TruncateEmptyRowsAndColumns);
复制代码
获取非空行列数据:
- if(this.IsPostBack)return;
- FpSpread1.ActiveSheetView.DataModel.SetValue(0,0,"First");
- FpSpread1.ActiveSheetView.DataModel.SetValue(0,1,"Second");
- FpSpread1.ActiveSheetView.DataModel.SetValue(0,2,"Third");
- FpSpread1.ActiveSheetView.DataModel.SetValue(2,0,"Un");
- FpSpread1.ActiveSheetView.DataModel.SetValue(2,1,"Deux");
- FpSpread1.ActiveSheetView.DataModel.SetValue(2,2,"Trois");
- FarPoint.Web.Spread.Model.DefaultSheetDataModelmodel=(FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
- ListBox1.Items.Add(Convert.ToString(model.NonEmptyColumnCount));
- ListBox1.Items.Add(Convert.ToString(model.NonEmptyRowCount));
复制代码 |