回复 1楼刘君的帖子
我在Spread设计器上给单元格添加一个Listbox类型,然后将行高设置为能完全显示出所有内容。
接着打印预览,没有重现你的问题。
另外根据PrintInfo类的注释,里面提供了BestFitCols和BestFitRows属性用来在自定义的时候调整行高和列宽,使得其自适应内容。
具体可以参考产品文档的Understanding the Printing Options章节。
文档索引:Spread Windows Forms 8.0 Product Documentation > Developer's Guide > Managing Printing > Customizing the Appearance of the Printing > Understanding the Printing Options
代码参考:
- // Typically you would use one type of optimization; they are all shown here for illustration only
- // Define the printer settings for optimization
- FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo();
- FarPoint.Win.Spread.SmartPrintRulesCollection prules = new FarPoint.Win.Spread.SmartPrintRulesCollection();
- // ... use best fit of columns and rows
- printset.BestFitCols = true;
- printset.BestFitRows = true;
- // ... or check by page size
- printset.SmartPrintPagesTall = 1;
- printset.SmartPrintPagesWide = 1;
- // ... or use the rules defined
- prules.Add(new FarPoint.Win.Spread.BestFitColumnRule(FarPoint.Win.Spread.ResetOption.None));
- prules.Add(new FarPoint.Win.Spread.LandscapeRule(FarPoint.Win.Spread.ResetOption.Current));
- prules.Add(new FarPoint.Win.Spread.ScaleRule(FarPoint.Win.Spread.ResetOption.None, 1, 0.6, 0.1));
- printset.SmartPrintRules = prules;
- printset.UseSmartPrint = true;
- // Assign the printer settings to the sheet and print it
- fpSpread1.Sheets[0].PrintInfo = printset;
- fpSpread1.PrintSheet(0);
复制代码 |