Table of Contents

Class Style

Namespace
iText.Layout
Assembly
itext.layout.dll

Container object for style properties of an element.

public class Style : ElementPropertyContainer<Style>, IPropertyContainer
Inheritance
Style
Implements
Inherited Members

Remarks

Container object for style properties of an element. A style can be used as an effective way to define multiple equal properties to several elements. Used in AbstractElement<T>. The properties set via Style have a lower priority than directly set properties. For example, if the same property is set directly and added via Style, then, no matter in which order they are set, the one set directly will be chosen.

Constructors

Style()

public Style()

Style(Style)

public Style(Style style)

Parameters

style Style

Methods

GetHeight()

Gets the height property of the 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 the 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

SetHeight(float)

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

public virtual Style SetHeight(float height)

Parameters

height float

a floating point value for the new height

Returns

Style

the block element itself.

SetHeight(UnitValue)

Sets the height property of the element with a UnitValue.

public virtual Style SetHeight(UnitValue height)

Parameters

height UnitValue

a UnitValue object

Returns

Style

this Element.

SetKeepTogether(bool)

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

public virtual Style SetKeepTogether(bool keepTogether)

Parameters

keepTogether bool

the new value of the KEEP_TOGETHER property

Returns

Style

this element

SetMargin(float)

Sets all margins around the element to the same width.

public virtual Style SetMargin(float commonMargin)

Parameters

commonMargin float

the new margin width

Returns

Style

this element

SetMarginBottom(float)

Sets the bottom margin width of the element.

public virtual Style SetMarginBottom(float value)

Parameters

value float

the new bottom margin width

Returns

Style

this element

SetMarginLeft(float)

Sets the left margin width of the element.

public virtual Style SetMarginLeft(float value)

Parameters

value float

the new left margin width

Returns

Style

this element

SetMarginRight(float)

Sets the right margin width of the element.

public virtual Style SetMarginRight(float value)

Parameters

value float

the new right margin width

Returns

Style

this element

SetMarginTop(float)

Sets the top margin width of the element.

public virtual Style SetMarginTop(float value)

Parameters

value float

the new top margin width

Returns

Style

this element

SetMargins(float, float, float, float)

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

public virtual Style 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

Style

this element

SetMaxHeight(float)

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

public virtual Style SetMaxHeight(float maxHeight)

Parameters

maxHeight float

a floating point value for the new max-height

Returns

Style

the block element itself

SetMaxHeight(UnitValue)

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

public virtual Style SetMaxHeight(UnitValue maxHeight)

Parameters

maxHeight UnitValue

a UnitValue object

Returns

Style

the block element itself

SetMaxWidth(float)

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

public virtual Style SetMaxWidth(float maxWidth)

Parameters

maxWidth float

a floating point value for the new max-width

Returns

Style

the block element itself

SetMaxWidth(UnitValue)

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

public virtual Style SetMaxWidth(UnitValue maxWidth)

Parameters

maxWidth UnitValue

a UnitValue object

Returns

Style

the block element itself

SetMinHeight(float)

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

public virtual Style SetMinHeight(float minHeight)

Parameters

minHeight float

a floating point value for the new min-height

Returns

Style

the block element itself

SetMinHeight(UnitValue)

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

public virtual Style SetMinHeight(UnitValue minHeight)

Parameters

minHeight UnitValue

a UnitValue object

Returns

Style

the block element itself

SetMinWidth(float)

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

public virtual Style SetMinWidth(float minWidth)

Parameters

minWidth float

a floating point value for the new min-width

Returns

Style

the block element itself

SetMinWidth(UnitValue)

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

public virtual Style SetMinWidth(UnitValue minWidth)

Parameters

minWidth UnitValue

a UnitValue object

Returns

Style

the block element itself

SetPadding(float)

Sets all paddings around the element to the same width.

public virtual Style SetPadding(float commonPadding)

Parameters

commonPadding float

the new padding width

Returns

Style

this element

SetPaddingBottom(float)

Sets the bottom padding width of the element.

public virtual Style SetPaddingBottom(float value)

Parameters

value float

the new bottom padding width

Returns

Style

this element

SetPaddingLeft(float)

Sets the left padding width of the element.

public virtual Style SetPaddingLeft(float value)

Parameters

value float

the new left padding width

Returns

Style

this element

SetPaddingRight(float)

Sets the right padding width of the element.

public virtual Style SetPaddingRight(float value)

Parameters

value float

the new right padding width

Returns

Style

this element

SetPaddingTop(float)

Sets the top padding width of the element.

public virtual Style SetPaddingTop(float value)

Parameters

value float

the new top padding width

Returns

Style

this element

SetPaddings(float, float, float, float)

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

public virtual Style 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

Style

this element

SetRotationAngle(double)

Sets the rotation angle.

public virtual Style SetRotationAngle(double angle)

Parameters

angle double

the new rotation angle, as a double

Returns

Style

this element

SetRotationAngle(float)

Sets the rotation radAngle.

public virtual Style SetRotationAngle(float radAngle)

Parameters

radAngle float

the new rotation radAngle, as a float

Returns

Style

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 Style 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

Style

this element

SetVerticalAlignment(VerticalAlignment?)

Sets the vertical alignment of the element.

public virtual Style SetVerticalAlignment(VerticalAlignment? verticalAlignment)

Parameters

verticalAlignment VerticalAlignment?

the vertical alignment setting

Returns

Style

this element

SetWidth(float)

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

public virtual Style SetWidth(float width)

Parameters

width float

a value measured in points.

Returns

Style

this Element.

SetWidth(UnitValue)

Sets the width property of the element with a UnitValue.

public virtual Style SetWidth(UnitValue width)

Parameters

width UnitValue

a UnitValue object

Returns

Style

this Element.