Back to Devexpress

XtraReport.ReportUnit Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-7ef05124.md

latest7.7 KB
Original Source

XtraReport.ReportUnit Property

Specifies the system of measurement that is used throughout a report for expressing the values of certain properties (e.g., an element’s location, dimensions and margins).

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue(ReportUnit.HundredthsOfAnInch)]
[SRCategory(ReportStringId.CatBehavior)]
public ReportUnit ReportUnit { get; set; }
vb
<DefaultValue(ReportUnit.HundredthsOfAnInch)>
<SRCategory(ReportStringId.CatBehavior)>
Public Property ReportUnit As ReportUnit

Property Value

TypeDefaultDescription
ReportUnitHundredthsOfAnInch

A ReportUnit enumeration value.

|

Available values:

NameDescription
Inches

The unit of measurement is in inches.

| | HundredthsOfAnInch |

The unit of measurement is in hundredths of an inch.

| | Millimeters |

The unit of measurement is in millimeters.

| | TenthsOfAMillimeter |

The unit of measurement is in tenths of a millimeter.

| | Pixels |

The unit of measurement is in pixels (one pixel equals 1 / 96 of an inch).

|

Remarks

The ReportUnit property specifies the units of measurement ( Imperial or Metric ) that are used to express values of such properties as XRControl.SizeF and XRControl.LocationF.

Only the XRControl.BorderWidth property value is expressed in ReportUnit.Pixels.

For a complete list of properties affected by this option, see the Report Units of Measurement topic.

Note

You can set the ReportUnit property globally, so that all the newly created reports have this property set to the required value. For this purpose, use the Report Designer Options dialog available within the XtraReports menu.

When setting ReportUnit.TenthsOfAMillimeter or ReportUnit.Millimeters as report units globally, new empty and data-based reports created via the Report Wizard have the XtraReport.PaperKind property set to PaperKind.A4. Otherwise, PaperKind.Letter is used.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ReportUnit property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/CS/Report_at_Runtime/PivotReportGenerator.cs#L148

csharp
else
    columnsWidth = GetColumnsBestFitWidth(dataTable, font, rep.ReportUnit);

reporting-winforms-label-report-in-code/CS/Reporting_how-to-create-a-label-report-at-runtime-t473792/LabelReportRuntime/CustomLabelReportBuilder.cs#L37

csharp
PaperKindList paperKindList = InitPaperKindList(model, report);
report.ReportUnit = model.MeasurementUnit == DXGraphicsUnit.Millimeter ? ReportUnit.TenthsOfAMillimeter : ReportUnit.HundredthsOfAnInch;
report.PaperKind = paperKindList.PaperKind;

reporting-winforms-best-fit-table-row-height/CS/dx_sample/XtraReport1.cs#L31

csharp
}
switch (this.ReportUnit) {
    case ReportUnit.HundredthsOfAnInch:

reporting-winforms-best-fit-table-column-width/CS/ReportHelper/ReportHelper.cs#L25

csharp
targetReport.PaperKind = DXPaperKind.Custom;
targetReport.ReportUnit = ReportUnit.Pixels;
targetReport.PageWidth = 3000;

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/VB/Report_at_Runtime/PivotReportGenerator.vb#L150

vb
Else
    columnsWidth = PivotReportGenerator.GetColumnsBestFitWidth(dataTable, font, rep.ReportUnit)
End If

reporting-winforms-label-report-in-code/VB/Reporting_how-to-create-a-label-report-at-runtime-t473792/LabelReportRuntime/CustomLabelReportBuilder.vb#L37

vb
Dim paperKindList As PaperKindList = InitPaperKindList(model, report)
report.ReportUnit = If(model.MeasurementUnit = System.Drawing.GraphicsUnit.Millimeter, ReportUnit.TenthsOfAMillimeter, ReportUnit.HundredthsOfAnInch)
report.PaperKind = paperKindList.PaperKind

reporting-winforms-best-fit-table-row-height/VB/dx_sample/XtraReport1.vb#L35

vb
Next p
Select Case Me.ReportUnit
    Case ReportUnit.HundredthsOfAnInch

reporting-winforms-best-fit-table-column-width/VB/ReportHelper/ReportHelper.vb#L31

vb
targetReport.PaperKind = DXPaperKind.Custom
targetReport.ReportUnit = ReportUnit.Pixels
targetReport.PageWidth = 3000

See Also

Report Units of Measurement

XtraReport Class

XtraReport Members

DevExpress.XtraReports.UI Namespace