Table of Contents

Class BlockElement<T>

Namespace
iText.Layout.Element
Assembly
itext.layout.dll

A BlockElement<T> will try to take up as much horizontal space as available to it on the canvas or page.

public abstract class BlockElement<T> : AbstractElement<T>, IAccessibleElement, IBlockElement, IAbstractElement, IElement, IPropertyContainer where T : IElement

Type Parameters

T

the type of the implementation

Inheritance
BlockElement<T>
Implements
Derived
Inherited Members

Remarks

A BlockElement<T> will try to take up as much horizontal space as available to it on the canvas or page. The concept is comparable to the block element in HTML. Also like in HTML, the visual representation of the object can be delimited by padding, a border, and/or a margin.

Constructors

BlockElement()

Creates a BlockElement.

protected BlockElement()

Methods

GetAccessibilityProperties()

public abstract AccessibilityProperties GetAccessibilityProperties()

Returns

AccessibilityProperties

GetDefaultProperty<T1>(int)

public override T1 GetDefaultProperty<T1>(int property)

Parameters

property int

Returns

T1

Type Parameters

T1

GetHeight()

Gets the height property of a block element.

public virtual UnitValue GetHeight()

Returns

UnitValue

the height of the element, as a floating point value. Null if the property is not present

GetMarginBottom()

Gets the current bottom margin width of the element.

public virtual UnitValue GetMarginBottom()

Returns

UnitValue

the bottom margin width, as a UnitValue object

GetMarginLeft()

Gets the current left margin width of the element.

public virtual UnitValue GetMarginLeft()

Returns

UnitValue

the left margin width, as a UnitValue object

GetMarginRight()

Gets the current right margin width of the element.

public virtual UnitValue GetMarginRight()

Returns

UnitValue

the right margin width, as a UnitValue object

GetMarginTop()

Gets the current top margin width of the element.

public virtual UnitValue GetMarginTop()

Returns

UnitValue

the top margin width, as a UnitValue object

GetPaddingBottom()

Gets the current bottom padding width of the element.

public virtual UnitValue GetPaddingBottom()

Returns

UnitValue

the bottom padding width, as a UnitValue object

GetPaddingLeft()

Gets the current left padding width of the element.

public virtual UnitValue GetPaddingLeft()

Returns

UnitValue

the left padding width, as a UnitValue object

GetPaddingRight()

Gets the current right padding width of the element.

public virtual UnitValue GetPaddingRight()

Returns

UnitValue

the right padding width, as a UnitValue object

GetPaddingTop()

Gets the current top padding width of the element.

public virtual UnitValue GetPaddingTop()

Returns

UnitValue

the top padding width, as a UnitValue object

GetWidth()

Gets the width property of a block element.

public virtual UnitValue GetWidth()

Returns

UnitValue

the width of the element, with a value and a measurement unit.

See Also

IsKeepTogether()

Returns whether the BlockElement<T> should be kept together as much as possible.

public virtual bool? IsKeepTogether()

Returns

bool?

the current value of the KEEP_TOGETHER property

IsKeepWithNext()

Returns whether the end of this BlockElement<T> and the start of the next sibling of this element should be placed in the same area.

public virtual bool? IsKeepWithNext()

Returns

bool?

the current value of the KEEP_WITH_NEXT property

SetHeight(float)

Sets the height property a block element as a point-value.

public virtual T SetHeight(float height)

Parameters

height float

a floating point value for the new height

Returns

T

the block element itself.

SetHeight(UnitValue)

Sets the height property of a block element with a UnitValue.

public virtual T SetHeight(UnitValue height)

Parameters

height UnitValue

a UnitValue object

Returns

T

this Element.

SetKeepTogether(bool)

Sets whether the BlockElement<T> should be kept together as much as possible.

public virtual T SetKeepTogether(bool keepTogether)

Parameters

keepTogether bool

the new value of the KEEP_TOGETHER property

Returns

T

this element

SetKeepWithNext(bool)

Sets whether the end of this BlockElement<T> and the start of the next sibling of this element should be placed in the same area.

public virtual T SetKeepWithNext(bool keepWithNext)

Parameters

keepWithNext bool

the new value of the KEEP_WITH_NEXT property

Returns

T

this element

Remarks

Sets whether the end of this BlockElement<T> and the start of the next sibling of this element should be placed in the same area. Note that this will only work for high-level elements, i.e. elements added to the RootElement<T>.

SetMargin(float)

Sets all margins around the element to the same width.

public virtual T SetMargin(float commonMargin)

Parameters

commonMargin float

the new margin width

Returns

T

this element

SetMarginBottom(float)

Sets the bottom margin width of the element.

public virtual T SetMarginBottom(float value)

Parameters

value float

the new bottom margin width

Returns

T

this element

SetMarginLeft(float)

Sets the left margin width of the element.

public virtual T SetMarginLeft(float value)

Parameters

value float

the new left margin width

Returns

T

this element

SetMarginRight(float)

Sets the right margin width of the element.

public virtual T SetMarginRight(float value)

Parameters

value float

the new right margin width

Returns

T

this element

SetMarginTop(float)

Sets the top margin width of the element.

public virtual T SetMarginTop(float value)

Parameters

value float

the new top margin width

Returns

T

this element

SetMargins(float, float, float, float)

Sets the margins around the element to a series of new widths.

public virtual T SetMargins(float marginTop, float marginRight, float marginBottom, float marginLeft)

Parameters

marginTop float

the new margin top width

marginRight float

the new margin right width

marginBottom float

the new margin bottom width

marginLeft float

the new margin left width

Returns

T

this element

SetMaxHeight(float)

Sets the max-height of a block element as point-unit value.

public virtual T SetMaxHeight(float maxHeight)

Parameters

maxHeight float

a floating point value for the new max-height

Returns

T

the block element itself

SetMaxHeight(UnitValue)

Sets the max-height property of a block element with a UnitValue.

public virtual T SetMaxHeight(UnitValue maxHeight)

Parameters

maxHeight UnitValue

a UnitValue object

Returns

T

the block element itself

SetMaxWidth(float)

Sets the max-width of a block element as point-unit value.

public virtual T SetMaxWidth(float maxWidth)

Parameters

maxWidth float

a floating point value for the new max-width

Returns

T

the block element itself

SetMaxWidth(UnitValue)

Sets the max-width property of a block element with a UnitValue.

public virtual T SetMaxWidth(UnitValue maxWidth)

Parameters

maxWidth UnitValue

a UnitValue object

Returns

T

the block element itself

SetMinHeight(float)

Sets the min-height of a block element as point-unit value.

public virtual T SetMinHeight(float minHeight)

Parameters

minHeight float

a floating point value for the new min-height

Returns

T

the block element itself

SetMinHeight(UnitValue)

Sets the min-height property of a block element with a UnitValue.

public virtual T SetMinHeight(UnitValue minHeight)

Parameters

minHeight UnitValue

a UnitValue object

Returns

T

the block element itself

SetMinWidth(float)

Sets the min-width of a block element as point-unit value.

public virtual T SetMinWidth(float minWidth)

Parameters

minWidth float

a floating point value for the new min-width

Returns

T

the block element itself

SetMinWidth(UnitValue)

Sets the min-width property of a block element with a UnitValue.

public virtual T SetMinWidth(UnitValue minWidth)

Parameters

minWidth UnitValue

a UnitValue object

Returns

T

the block element itself

SetNeutralRole()

Give this element a neutral role.

public virtual T SetNeutralRole()

Returns

T

this Element

Remarks

Give this element a neutral role. See also SetRole(string).

SetPadding(float)

Sets all paddings around the element to the same width.

public virtual T SetPadding(float commonPadding)

Parameters

commonPadding float

the new padding width

Returns

T

this element

SetPaddingBottom(float)

Sets the bottom padding width of the element.

public virtual T SetPaddingBottom(float value)

Parameters

value float

the new bottom padding width

Returns

T

this element

SetPaddingLeft(float)

Sets the left padding width of the element.

public virtual T SetPaddingLeft(float value)

Parameters

value float

the new left padding width

Returns

T

this element

SetPaddingRight(float)

Sets the right padding width of the element.

public virtual T SetPaddingRight(float value)

Parameters

value float

the new right padding width

Returns

T

this element

SetPaddingTop(float)

Sets the top padding width of the element.

public virtual T SetPaddingTop(float value)

Parameters

value float

the new top padding width

Returns

T

this element

SetPaddings(float, float, float, float)

Sets the paddings around the element to a series of new widths.

public virtual T SetPaddings(float paddingTop, float paddingRight, float paddingBottom, float paddingLeft)

Parameters

paddingTop float

the new padding top width

paddingRight float

the new padding right width

paddingBottom float

the new padding bottom width

paddingLeft float

the new padding left width

Returns

T

this element

SetRotationAngle(double)

Sets the rotation angle.

public virtual T SetRotationAngle(double angleInRadians)

Parameters

angleInRadians double

the new rotation angle, as a double, in radians

Returns

T

this element

SetRotationAngle(float)

Sets the rotation radAngle.

public virtual T SetRotationAngle(float angleInRadians)

Parameters

angleInRadians float

the new rotation radAngle, as a float, in radians

Returns

T

this element

SetSpacingRatio(float)

Sets a ratio which determines in which proportion will word spacing and character spacing be applied when horizontal alignment is justified.

public virtual T SetSpacingRatio(float ratio)

Parameters

ratio float

the ratio coefficient. It must be between 0 and 1, inclusive. It means that ratio part of the free space will be compensated by word spacing, and 1-ratio part of the free space will be compensated by character spacing. If ratio is 1, additional character spacing will not be applied. If ratio is 0, additional word spacing will not be applied.

Returns

T

this element

SetVerticalAlignment(VerticalAlignment?)

Sets the vertical alignment of the element.

public virtual T SetVerticalAlignment(VerticalAlignment? verticalAlignment)

Parameters

verticalAlignment VerticalAlignment?

the vertical alignment setting

Returns

T

this element

SetWidth(float)

Sets the width property of a block element, measured in points.

public virtual T SetWidth(float width)

Parameters

width float

a value measured in points.

Returns

T

this Element.

SetWidth(UnitValue)

Sets the width property of a block element with a UnitValue.

public virtual T SetWidth(UnitValue width)

Parameters

width UnitValue

a UnitValue object

Returns

T

this Element.