-
Notifications
You must be signed in to change notification settings - Fork 0
/
XtraReport1.cs
41 lines (40 loc) · 1.48 KB
/
XtraReport1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.NativeBricks;
namespace dx_sample {
public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport {
float DetailHeight = 0;
public XtraReport1() {
InitializeComponent();
}
public void CreateCustomDocument() {
CreateDocument();
xrTable2.BeginInit();
xrTable2.HeightF = DetailHeight;
xrTable2.EndInit();
CreateDocument();
}
protected override void AfterReportPrint() {
if (DetailHeight != 0) return;
foreach (DevExpress.XtraPrinting.Page p in this.Pages) {
foreach (Brick b in p) {
if (b is TableBrick) {
DetailHeight = Math.Max(DetailHeight, b.Size.Height);
}
}
}
switch (this.ReportUnit) {
case ReportUnit.HundredthsOfAnInch:
DetailHeight = 100 * GraphicsUnitConverter.Convert(DetailHeight, GraphicsUnit.Document, GraphicsUnit.Inch);
break;
case ReportUnit.TenthsOfAMillimeter:
DetailHeight = 10 * GraphicsUnitConverter.Convert(DetailHeight, GraphicsUnit.Document, GraphicsUnit.Millimeter);
break;
}
}
}
}