抱歉,这个功能目前无法实现。不过可以把几个 Sheet 添加到一个临时 Spread ,导出到同一个 Excel 的不同 Sheet 中:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- FpSpread1.ActiveSheetView.RowCount = 5;
- FpSpread1.ActiveSheetView.ColumnCount = 2;
- for (int r = 0; r < FpSpread1.ActiveSheetView.RowCount; r++)
- {
- FpSpread1.ActiveSheetView.Cells[r, 0].Value = r + 1;
- FpSpread1.ActiveSheetView.Cells[r, 1].Value = "Item" + (r + 1).ToString();
- }
- FpSpread2.ActiveSheetView.RowCount = 5;
- FpSpread2.ActiveSheetView.ColumnCount = 2;
- for (int r = 0; r < FpSpread2.ActiveSheetView.RowCount; r++)
- {
- FpSpread2.ActiveSheetView.Cells[r, 0].Value = r + 1;
- FpSpread2.ActiveSheetView.Cells[r, 1].Value = "Name" + (r + 1).ToString();
- }
- FpSpread3.ActiveSheetView.RowCount = 5;
- FpSpread3.ActiveSheetView.ColumnCount = 2;
- for (int r = 0; r < FpSpread3.ActiveSheetView.RowCount; r++)
- {
- FpSpread3.ActiveSheetView.Cells[r, 0].Value = r + 1;
- FpSpread3.ActiveSheetView.Cells[r, 1].Value = "Record" + (r + 1).ToString();
- }
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- FarPoint.Web.Spread.FpSpread tempspread = new FarPoint.Web.Spread.FpSpread();
- FpSpread1.Sheets[0].SheetName = "Sheet1";
- tempspread.Sheets.Add(FpSpread1.Sheets[0]);
- FpSpread2.Sheets[0].SheetName = "Sheet2";
- tempspread.Sheets.Add(FpSpread2.Sheets[0]);
- FpSpread3.Sheets[0].SheetName = "Sheet3";
- tempspread.Sheets.Add(FpSpread3.Sheets[0]);
- tempspread.SaveExcel(Server.MapPath(@"~/Test.xls"));
- }
复制代码 |