TextFragment

Overview

TextFragment is a class in Aspose.PDF FOSS for .NET. Inherits from: BaseParagraph.

Represents a fragment of text on a page with position and style information.

This class declares 9 methods for TextFragment objects in .NET programs. Available methods include: BaseParagraph, Clone, CloneWithSegments, IsolateTextSegments, TextFragment. Public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: BaselinePosition, BlockBackgroundPictures, BlockBorder, BlockBoxed, BlockCornerRadii, BlockHorizontalAlignment, and 34 more.

Properties

NameTypeAccessDescription
TextEditOptionsTextEditOptionsRead/WriteEdit options applied during text replacement / font substitution.
VerticalAlignmentVerticalAlignmentRead/WriteGets or sets the vertical alignment.
TextstringRead/WriteThe text content.
ReplaceOptionsTextReplaceOptionsReadText-replacement options used by TextFragmentAbsorber replace paths.
PagePage?ReadThe page this fragment belongs to (public alias for SourcePage).
FormXForm?ReadThe XForm this fragment was extracted from, or null for page-level fragments.
HorizontalAlignmentHorizontalAlignmentRead/WriteHorizontal alignment used when this fragment is laid out as a paragraph (added to page.Paragraphs).
RectangleRectangle?ReadThe bounding rectangle of this text fragment on the page.
PositionPosition?Read/WriteThe text position.
BaselinePositionPosition?Read/WriteThe text baseline position.
MarginMarginInfoRead/WriteMargin information for layout when used as a paragraph element.
TextStateTextFragmentStateReadText state (font, size, color).
PageIndexintReadThe page index (0-based) this fragment was found on.
FontSizedoubleReadShortcut for TextState.FontSize.
SegmentsTextSegmentCollectionRead/WriteThe collection of text segments that make up this fragment (1-indexed).
HyperlinkHyperlinkRead/WriteHyperlink applied to this fragment.
BlockBorderBorderInfo?Read/WriteA border drawn around the paragraph’s BLOCK when it flows on a page: around its padding and line boxes, inside its Margin.
BlockPaddingMarginInfo?Read/WriteSpace between the block’s border (or its edge) and its line boxes, on each side.
BlockWidthdoubleRead/WriteThe width of the block’s CONTENT – its line boxes – in points; padding and border add outside it.
BlockMaxWidthdoubleRead/WriteThe most the block’s content may be wide; the block shrinks to it when the region is wider.
BoxHeightdoubleRead/WriteThe height of the block’s content box, in points; padding and border add outside it.
BoxMinHeightdoubleRead/WriteThe least the block’s content box may be tall.
BoxMaxHeightdoubleRead/WriteThe most the block’s content box may be tall: a taller content is cut to it, lines beyond dropped, and a declared BoxHeight above it is brought down to it; the floor wins over it.
BlockMinWidthdoubleRead/WriteThe least the block’s content box may be wide: a narrower declared or fitted width grows to it.
BlockHorizontalAlignmentHorizontalAlignmentRead/WriteWhere a block narrower than its region stands across it.
BlockVerticalAlignmentVerticalAlignmentRead/WriteWhere a SINGLE line stands inside a content box taller than it is.
BlockBoxedboolRead/WriteLays the fragment as a block box even when no other block property is set – what makes the flow honour its Margin’s LEFT and RIGHT, which a plain flow fragment has never taken.
BlockCornerRadiiCornerRadii?Read/WriteRounds the block’s corners (see CornerRadii): the background is painted inside the rounded outline and the BlockBorder inside the ring between it and the inner outline.
BlockBackgroundPicturesList<BackgroundPicture>ReadPictures painted over the block’s background and under its border and text, the first on top (see BackgroundPicture).
TabStopsTabStops?Read/WriteTab stops for this fragment (used with #$TAB markers in text).
IsInLineParagraphboolRead/WriteWhen true, this text fragment renders on the same line as the previous in-line paragraph.
IsInNewPageboolRead/WriteGets or sets the is in new page.
IsKeptTogetherboolRead/WriteWhether the fragment’s lines stay on ONE page: when they do not all fit in the room left on the current page but would fit an empty one, the fragment starts on the next page instead of splitting.
FootNoteNote?Read/WriteOptional footnote attached to this fragment.
EndNoteNote?Read/WriteEndnote attached to this fragment.
WrapLinesCountintRead/WriteNumber of wrapped lines computed during layout.
IsFirstParagraphInColumnboolRead/WriteForce the paragraph to start a new column.
IsKeptWithNextboolRead/WriteKeep this paragraph on the same page as the next one.
HyperlinkTextstring?Read/WriteLegacy string-typed hyperlink target.
ZIndexintRead/WriteZ-order index used by the DOM renderer.

Methods

SignatureDescription
TextFragment()Create an empty text fragment.
TextFragment(tabStops: TabStops)Creates an empty text fragment that aligns its tab characters to the given tab stops; the text is added later through Segments or Text.
TextFragment(text: string)Create a text fragment with the given text.
TextFragment(text: string, tabStops: TabStops)Create a text fragment with the given text and tabStops resolution table.
TextFragment(text: string, rectangle: Rectangle?, textState: TextState?)Creates a text fragment with the given text, an optional bounding rectangle (in points) and an optional text state whose settings are copied onto the fragment.
Clone()Shallow copy of the fragment (text + state).
IsolateTextSegments(startIndex: int, length: int)Isolate the character range [startIndex, startIndex+length) (startIndex is a 0-based character offset into the fragment’s text) into its own TextSegment(s): the covering segment is split into up to three pieces (before / isolated / after), each inheriting the original segment’s TextState, and the fragment’s Segments collection is rebuilt to reflect the split.
CloneWithSegments()Clone the fragment AND its segments.
BaseParagraph()Creates a paragraph with default alignment, an empty margin and no hyperlink.

See Also

 English