你好,使用下面代码,设置生效:
- private void Form1_Load(object sender, EventArgs e)
- {
- var rules = new SmartPrintRulesCollection();
- rules.Add(new SmartPaperRule(ResetOption.None));
- rules.Add(new BestFitColumnRule(ResetOption.None));
- rules.Add(new ScaleRule(ResetOption.None, 1, 0.1f, 0.01f));
- PrintInfo printInfo = new PrintInfo();
- printInfo.ZoomFactor = 2;
- printInfo.SmartPrintRules = rules;
- printInfo.SmartPrintPagesTall = 10;
- printInfo.SmartPrintPagesWide = 10;
- printInfo.UseSmartPrint = true;
- //设置 Spread PrintInfo 属性
- this.fpSpread1.Sheets[0].PrintInfo = printInfo;
- for (int i = 0; i < 20; i++)
- {
- for (int j = 0; j < 20; j++)
- {
- this.fpSpread1.Sheets[0].Cells[i, j].Text = "test";
- }
- }
- this.fpSpread1.PrintSheet(0);
- }
复制代码 |