回复 13楼xingyuan2010000的帖子
Spread 控件性能消耗主要有两点:数据量和UI。
从数据流入手,建议您采取按需加载和分页相结合的方式来缓解:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- DataTable dt = new DataTable();
- dt.Columns.Add("Col1");
- dt.Columns.Add("Col2");
- for (int i = 0; i < 200; i++)
- {
- dt.Rows.Add("1", "1");
- }
- this.FpSpread1.DataSource = dt;
- SheetView sheet = this.FpSpread1.Sheets[0];
- //按需加载
- sheet.AllowLoadOnDemand = true;
- sheet.LoadInitRowCount = 10;
- sheet.LoadRowIncrement = 5;
- sheet.LoadOnDemandMode = FarPoint.Web.Spread.LoadOnDemandMode.Background;
- sheet.LoadOnDemandTriggerMode = FarPoint.Web.Spread.LoadOnDemandTriggerMode.Timed;
- sheet.LoadOnDemandInterval = 1000;
- //分页
- sheet.AllowPage = true;
- sheet.PageSize = 50;
- this.FpSpread1.Sheets[0].Rows.Add(0, 1);
- this.FpSpread1.Sheets[0].Cells[0, 0].Text = "测试";
- this.FpSpread1.Sheets[0].AddSpanCell(0, 0, 1, 2);
- }
复制代码
UI 方面只能减少单元格样式。
请您尝试分页和按需加载结合的方式,看能否有所缓解。 |