找回密码
 立即注册

QQ登录

只需一步,快速开始

zhangli8028

新手上路

1

主题

1

帖子

21

积分

新手上路

积分
21
  • 20

    金币

  • 主题

  • 帖子

最新发帖
foreach (FarPoint.Web.Spread.Row r in FpSpread1.Sheets[0].Rows)
        {
            //获取计量单位,以便格式转换
            string data_unit;
            data_unit = Convert.ToString(FpSpread1.ActiveSheetView.GetValue(r.Index, 7));

            foreach (FarPoint.Web.Spread.Column c in FpSpread1.Sheets[0].Columns)
            {
                if (c.DataField == "lst_id")
                {
                    c.Visible = false;
                }
                else
                {

                    if (list.Contains(c.DataField))
                    {
                        farmat_celltype(data_unit, r.Index, c.Index);
                    }

                }
            }
}
    protected void farmat_celltype(string data_unit,int row ,int col)
    {
        if (data_unit == "%")
        {
            FarPoint.Web.Spread.PercentCellType Per_Cell = new FarPoint.Web.Spread.PercentCellType();
            //c.CellType = Per_Cell;
            FpSpread1.ActiveSheetView.Cells[row, col].CellType = Per_Cell;
        }
        else
        {
            FarPoint.Web.Spread.DoubleCellType dou_Cell = new FarPoint.Web.Spread.DoubleCellType();
            FpSpread1.ActiveSheetView.Cells[row, col].CellType = dou_Cell;
        }

    }
、、、、、、、、、、、、、、、、、、、、一下是导出:
FpSpread1.SaveExcelToResponse(Server.UrlEncode("导出信息") + DateTime.Now.ToString("yyyymmdd") + ".xls", FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);

1 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-3-21 10:27:00
沙发
zhangli8028 你好,

使用你的 代码 ,设置数据量为 650行*9列,并没有重现 分页失效 和 Excel 为空问题。
下面是我的 Demo,请对比:
测试环境为 : Spread for ASP.NET 3.0 && VS2005
WebSite1.zip (993.73 KB, 下载次数: 398)
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部