/// <summary> /// 计算纸张的大小 单位像素 /// </summary> /// <param name="setting"></param> /// <returns></returns> public static PaperSizeF GetPaperSizePX(I3PageSetting setting) { PaperSizeF size = GetPaperSizeMM(setting); size.Width = PaperSizeHelper.MM2PX(size.Width); size.Height = PaperSizeHelper.MM2PX(size.Height); return(size); }
/// <summary> /// 根据内容调整页面宽度为一页(自定义字纸张时才有效) /// </summary> public void AdjustPaperWidthToOnePage() { if (this.PageSetting.PaperType != PaperType.Custom) { throw new Exception("纸张类型为Custom时,才可调用AdjustPaperWidthToOnePage方法"); } this.ReCalSizeAndPageInfo(); float totalWidth = 0; foreach (I3ReportCol col in this.cols) { totalWidth += col.Width; } float customWidth = this.PageSetting.CustomPaperWidthPX - this.PageSetting.PaperContentRect.Width + totalWidth; this.PageSetting.CustomPaperWidthMM = PaperSizeHelper.PX2MM(customWidth + 1); }
/// <summary> /// 根据内容调整页面高度为一页(自定义字纸张时才有效) /// </summary> public void AdjustPaperHeightToOnePage() { if (this.PageSetting.PaperType != PaperType.Custom) { throw new Exception("纸张类型为Custom时,才可调用AdjustPaperHeightToOnePage方法"); } this.ReCalSizeAndPageInfo(); float totalHeight = 0; foreach (I3ReportRow row in this.Rows) { totalHeight += row.Height; } float customHeight = this.PageSetting.CustomPaperHeightPX - this.PageSetting.PaperContentRect.Height + totalHeight; this.PageSetting.CustomPaperHeightMM = PaperSizeHelper.PX2MM(customHeight + 1); }