zplCore.comzplCore.com

ZplContext

public sealed class ZplContext

Constructors

SignatureDescription
# ZplContext(int dpi, LabelUnit unit, Func<string, object> fieldResolver, int index)

Properties

PropertyTypeDescription
Dpi { get; }int
Engine { get; init; }ExpressionEngine
FieldResolver { get; }Func<string, object>Resolves a data field name for the current record (null = unbound/not found).
Index { get; }intZero-based record index.
ItemValues { get; }Dictionary<string, string>Resolved text of named items generated so far (usable as [ItemName] in expressions).
Measurer { get; init; }ITextMeasurerText measurement for auto-fit (provided by the label, uses its fonts).
Serial { get; init; }intZero-based printed-label number (records × copies) used by counters; -1 = same as ZplContext.Index.
Unit { get; }LabelUnit

Methods

Method SignatureReturnsDescription
# Dots(double value)int
# Dots(double value, LabelUnit? unit)intConverts a value given in unit (null = the label unit) to dots.
# DotsExact(double value, LabelUnit? unit = default)doubleExact (unrounded) dots for a value in unit (null = the label unit).
# Evaluate(string expression)string
# Lookup(string field, string format)string
# Lookup(string field, string format, CultureInfo culture)stringLooks up and formats a field value with an explicit culture. Without a culture a format is applied with the invariant culture (labels don't change with the server's regional settings), an unformatted value is converted with the current culture. A format also applies to text that is a number ("12.5"), when it is a number format (see NumericText). The culture's standard calendar and plain spaces apply (ExpressionEngine.StandardCalendar), so the text is the same on every operating system.
# PointsToDots(double pt)intFont sizes are always given in points.