PDF打印-怎么把所有列打印到一页

发布时间:2012/11/14 00:11 发布者:葡萄城产品团队

返回博客中心

Spread for ASP.NET 打印到 PDF 提供了强大的格式定制功能,这些功能由 PrintInfo 提供,最常见的用例之一就是当 Sheet 中有很多列时怎样把所有列打印到一页。下面就通过代码展示设置方法:

 
protected void Page_Load(object sender, EventArgs e)

        {

            if (IsPostBack)

                return;

            this.FpSpread1.CommandBar.ShowPDFButton = true;

            this.FpSpread1.Sheets[0].PageSize = 40;

            this.FpSpread1.Sheets[0].ColumnCount = 20;

            this.FpSpread1.Sheets[0].RowCount = 30;

            for (int i = 0; i < 20; i++)

            {

                for (int j = 0; j < 30; j++)

                {

                    this.FpSpread1.Sheets[0].Cells[j, i].Text = i.ToString() + "列" + j.ToString() + "行";

                }

            }

            FarPoint.Web.Spread.PrintInfo prinf = new FarPoint.Web.Spread.PrintInfo();

            FarPoint.Web.Spread.SmartPrintRulesCollection prules = new FarPoint.Web.Spread.SmartPrintRulesCollection();

            prules.Add(new FarPoint.Web.Spread.SmartPaperRule(FarPoint.Web.Spread.ResetOption.None));

            prinf.SmartPrintRules = prules;

            prinf.UseSmartPrint = true;

            FpSpread1.ActiveSheetView.PrintInfo = prinf;

        }

复制代码


关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网