在前台页面显示正常,但是在导出的Excel没有导出来合并的单元格, 请教怎么设置。
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- FpSpread1.Width = 1000;
- FpSpread1.Height = 540;
- FpSpread1.ActiveSheetView.DefaultRowHeight = 100;
- FpSpread1.ActiveSheetView.PageSize = 300;
- for (int i = 1; i < 4; i++)
- {
- FpSpread1.ActiveSheetView.SetColumnMerge(i, FarPoint.Web.Spread.Model.MergePolicy.Always);
- }
- }
- }
- protected void btnSaveExcel_Click(object sender, EventArgs e)
- {
- string filepath = Server.MapPath("~/test.xlsx");
- FpSpread1.SaveExcel(filepath, FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);
- string filename = Path.GetFileName(filepath);
- FileInfo file = new FileInfo(filepath);
- Response.Clear();
- Response.ContentType = "application/octet-stream";
- Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));
- Response.AddHeader("Content-length", file.Length.ToString());
- Response.Flush();
- Response.WriteFile(filepath);
- }
复制代码
|