关于按照PageNumber进行分页打印的方法,需要在Spread的PrintSheet事件中动态的来设置PageBreak属性:
- protected void FpSpread1_PrintSheet(object sender, FarPoint.Web.Spread.PrintEventArgs e)
- {
- if (e.Row > -1)
- {
- int current = Convert.ToInt32(FpSpread1.Sheets[e.SheetIndex].Cells[e.Row, 0].Text);
- int next = current;
- if (FpSpread1.Sheets[e.SheetIndex].RowCount > e.Row + 1)
- {
- next = Convert.ToInt32(FpSpread1.Sheets[e.SheetIndex].Cells[e.Row + 1, 0].Text);
- // 如果PageNumber发生变化,需要进行分页打印
- if (next != current)
- {
- e.PageBreak = true;
- }
- }
- }
- }
复制代码
|