Table of Contents

Class RtfShape

Namespace
iTextSharp.text.rtf.graphic
Assembly
iTextSharp.LGPLv2.Core.dll

The RtfShape provides the interface for adding shapes to the RTF document. This will only work for Word 97+, older Word versions are not supported by this class.

Only very simple shapes are directly supported by the RtfShape. For more complex shapes you will have to read the RTF specification (iText follows the 1.6 specification) and add the desired properties via the RtfShapeProperty.

One thing to keep in mind is that distances are not expressed in the standard iText point, but in EMU where 1 inch = 914400 EMU or 1 cm = 360000 EMU. @version $Revision: 1.7 $ @author Mark Hall (Mark.Hall@mail.room3b.eu)

public class RtfShape : RtfAddableElement, IElement, IRtfBasicElement, IRtfElementInterface
Inheritance
RtfShape
Implements
Inherited Members

Constructors

RtfShape(int, RtfShapePosition)

Constructs a new RtfShape of a given shape at the given RtfShapePosition.

public RtfShape(int type, RtfShapePosition position)

Parameters

type int

The type of shape to create.

position RtfShapePosition

The RtfShapePosition to create this RtfShape at.

Fields

SHAPE_ARC

Constant for an arc shape.

public const int SHAPE_ARC = 19

Field Value

int

SHAPE_ARROR_THICK

Constant for a thick arrow.

public const int SHAPE_ARROR_THICK = 14

Field Value

int

SHAPE_ARROW

Constant for an arrow.

public const int SHAPE_ARROW = 13

Field Value

int

SHAPE_BALLOON

Constant for a balloon shape.

public const int SHAPE_BALLOON = 17

Field Value

int

SHAPE_CAN

Constant for a can shape.

public const int SHAPE_CAN = 22

Field Value

int

SHAPE_CUBE

Constant for a cube shape.

public const int SHAPE_CUBE = 16

Field Value

int

SHAPE_DIAMOND

Constant for a diamond.

public const int SHAPE_DIAMOND = 4

Field Value

int

SHAPE_DONUT

Constant for a donut shape.

public const int SHAPE_DONUT = 23

Field Value

int

SHAPE_ELLIPSE

Constant for an ellipse. Use this to create circles.

public const int SHAPE_ELLIPSE = 3

Field Value

int

SHAPE_FREEFORM

Constant for a free form shape. The shape verticies must be specified with an array of Point objects in a RtfShapeProperty with the name PROPERTY_VERTICIES.

public const int SHAPE_FREEFORM = 0

Field Value

int

SHAPE_HEXAGON

Constant for a hexagon.

public const int SHAPE_HEXAGON = 9

Field Value

int

SHAPE_HOME_PLATE

Constant for a home plate style shape.

public const int SHAPE_HOME_PLATE = 15

Field Value

int

SHAPE_LINE

Constant for a line shape.

public const int SHAPE_LINE = 20

Field Value

int

SHAPE_OCTAGON

Constant for an ocatagon.

public const int SHAPE_OCTAGON = 10

Field Value

int

SHAPE_PARALLELOGRAM

Constant for a parallelogram.

public const int SHAPE_PARALLELOGRAM = 7

Field Value

int

SHAPE_PICTURE_FRAME

Constant for a Picture Frame.

public const int SHAPE_PICTURE_FRAME = 75

Field Value

int

SHAPE_RECTANGLE

Constant for a rectangle.

public const int SHAPE_RECTANGLE = 1

Field Value

int

SHAPE_ROUND_RECTANGLE

Constant for a rounded rectangle. The roundness is set via a RtfShapeProperty with the name PROPERTY_ADJUST_VALUE.

public const int SHAPE_ROUND_RECTANGLE = 2

Field Value

int

SHAPE_SEAL

Constant for a seal shape.

public const int SHAPE_SEAL = 18

Field Value

int

SHAPE_STAR

Constant for a star.

public const int SHAPE_STAR = 12

Field Value

int

SHAPE_TRAPEZOID

Constant for a trapezoid.

public const int SHAPE_TRAPEZOID = 8

Field Value

int

SHAPE_TRIANGLE_ISOSCELES

Constant for a isoscelle triangle.

public const int SHAPE_TRIANGLE_ISOSCELES = 5

Field Value

int

SHAPE_TRIANGLE_RIGHT

Constant for a right triangle.

public const int SHAPE_TRIANGLE_RIGHT = 6

Field Value

int

SHAPE_WRAP_BOTH

Text is wrapped on the left and right side.

public const int SHAPE_WRAP_BOTH = 2

Field Value

int

SHAPE_WRAP_LARGEST

Text is wrapped on the largest side.

public const int SHAPE_WRAP_LARGEST = 5

Field Value

int

SHAPE_WRAP_LEFT

Text is wrapped on the left side.

public const int SHAPE_WRAP_LEFT = 3

Field Value

int

SHAPE_WRAP_NONE

Text is not wrapped around the shape.

public const int SHAPE_WRAP_NONE = 0

Field Value

int

SHAPE_WRAP_RIGHT

Text is wrapped on the right side.

public const int SHAPE_WRAP_RIGHT = 4

Field Value

int

SHAPE_WRAP_THROUGH

Text is wrapped through the shape.

public const int SHAPE_WRAP_THROUGH = 10

Field Value

int

SHAPE_WRAP_TIGHT_BOTH

Text is tightly wrapped on the left and right side.

public const int SHAPE_WRAP_TIGHT_BOTH = 6

Field Value

int

SHAPE_WRAP_TIGHT_LARGEST

Text is tightly wrapped on the largest side.

public const int SHAPE_WRAP_TIGHT_LARGEST = 9

Field Value

int

SHAPE_WRAP_TIGHT_LEFT

Text is tightly wrapped on the left side.

public const int SHAPE_WRAP_TIGHT_LEFT = 7

Field Value

int

SHAPE_WRAP_TIGHT_RIGHT

Text is tightly wrapped on the right side.

public const int SHAPE_WRAP_TIGHT_RIGHT = 8

Field Value

int

SHAPE_WRAP_TOP_BOTTOM

Text is wrapped to the top and bottom.

public const int SHAPE_WRAP_TOP_BOTTOM = 1

Field Value

int

Methods

SetProperty(RtfShapeProperty)

Sets a property.

public void SetProperty(RtfShapeProperty property)

Parameters

property RtfShapeProperty

The property to set for this RtfShape.

SetShapeText(string)

Sets the text to display in this RtfShape.

public void SetShapeText(string shapeText)

Parameters

shapeText string

The text to display.

SetWrapping(int)

Set the wrapping mode.

public void SetWrapping(int wrapping)

Parameters

wrapping int

The wrapping mode to use for this RtfShape.

WriteContent(Stream)

Writes the RtfShape. Some settings are automatically translated into or require other properties and these are set first.

public override void WriteContent(Stream outp)

Parameters

outp Stream