PdfTextRun
OfficeIMO.Pdf
Inline text segment with basic styling.
Inheritance
- object
- PdfTextRun
Usage
Explore 83 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 50
- Method PdfEmbeddedFontFallbackSet.PlanTextRuns
- Property PdfFooterSegment.StyledRun
- Property PdfKeyValueRow.KeyRuns
- Property PdfKeyValueRow.ValueRuns
- Property PdfListItem.Runs
- Method PdfParagraph.AddBookmarkLink
- Method PdfParagraph.AddInline
- Method PdfParagraph.AddInlineBox
- Method PdfParagraph.AddInlineImage
- Method PdfParagraph.AddLineBreak
- Method PdfParagraph.AddLink
- Method PdfParagraph.AddTab
- Method PdfParagraph.AddText
- Property PdfParagraph.Runs
- Property PdfTableCell.Runs
- Method PdfTextFallbackPlan.ToNamedTextRuns
- Method PdfTextFallbackPlan.ToTextRuns
- Method PdfTextRun.Bolded
- Method PdfTextRun.BoldItalic
- Method PdfTextRun.BoldUnderlined
- Method PdfTextRun.Inline
- Method PdfTextRun.Italicized
- Method PdfTextRun.LineBreak
- Method PdfTextRun.Link
- Method PdfTextRun.LinkToBookmark
- Method PdfTextRun.Normal
- Method PdfTextRun.SetBackgroundColor
- Method PdfTextRun.SetBaseline
- Method PdfTextRun.SetBold
- Method PdfTextRun.SetCharacterSpacing
- Method PdfTextRun.SetColor
- Method PdfTextRun.SetFontFamily
- Method PdfTextRun.SetFontSize
- Method PdfTextRun.SetHorizontalTextScaling
- Method PdfTextRun.SetItalic
- Method PdfTextRun.SetStandardFont
- Method PdfTextRun.SetStrikethrough
- Method PdfTextRun.SetSubscript
- Method PdfTextRun.SetSuperscript
- Method PdfTextRun.SetUnderline
- Method PdfTextRun.Strikethrough
- Method PdfTextRun.Subscript
- Method PdfTextRun.Superscript
- Method PdfTextRun.Tab
- Method PdfTextRun.Underlined
- Method PdfTextRun.WithCharacterSpacing
- Method PdfTextRun.WithFeatureSettings
- Method PdfTextRun.WithFootnoteReference
- Method PdfTextRun.WithHorizontalTextScaling
- Method PdfTextRun.WithTextCase
Accepted by parameters 33
- Method PdfEmbeddedFontFallbackSet.PlanTextRuns
- Method PdfEmbeddedFontFallbackSet.TryPlanTextRuns
- Method PdfEmbeddedFontFallbackSet.TryPlanTextRuns
- Method PdfFooterSegment.DocumentPages
- Method PdfFooterSegment.PageNumber
- Method PdfFooterSegment.RichText
- Method PdfFooterSegment.TotalPages
- Method PdfFooterTextBuilder.CurrentPage
- Method PdfFooterTextBuilder.DocumentPages
- Method PdfFooterTextBuilder.Run
- Method PdfFooterTextBuilder.TotalPages
- Method PdfHeaderTextBuilder.CurrentPage
- Method PdfHeaderTextBuilder.DocumentPages
- Method PdfHeaderTextBuilder.Run
- Method PdfHeaderTextBuilder.TotalPages
- Constructor PdfKeyValueRow.PdfKeyValueRow
- Constructor PdfKeyValueRow.PdfKeyValueRow
- Method PdfKeyValueRow.Rich
- Method PdfKeyValueRow.Rich
- Constructor PdfListItem.PdfListItem
- Method PdfListItem.Rich
- Method PdfPageCanvas.Text
- Method PdfPageCanvas.TextBox
- Method PdfParagraph.AddRuns
- Constructor PdfTableCell.PdfTableCell
- Method PdfTableCell.Merge
- Method PdfTableCell.RichTextCell
- Method PdfTableCell.Span
- Method PdfTableCell.WithCheckBoxes
- Method PdfTableCell.WithFormFields
- Method PdfTableCell.WithImages
- Method PdfTextFallbackPlan.ToNamedTextRuns
- Method PdfTextFallbackPlan.ToTextRuns
Constructors
public PdfTextRun(string text, bool bold = false, bool underline = false, OfficeColor? color = null, bool italic = false, bool strike = false, OfficeLength? fontSize = null, PdfStandardFont? standardFont = null, string? linkUri = null, string? linkContents = null, PdfTextBaseline baseline = Normal, string? linkDestinationName = null, PdfTabLeaderStyle tabLeader = None, PdfTabAlignment tabAlignment = Left, OfficeColor? backgroundColor = null, string? fontFamily = null, OfficeTextDecorationStyle underlineStyle = None, OfficeTextDecorationStyle strikeStyle = None, OfficeColor? decorationColor = null) #Create a new run with the specified styles and tab alignment.
Parameters
- text string
- bold bool = false
- underline bool = false
- color OfficeIMO.OfficeColor? = null
- italic bool = false
- strike bool = false
- fontSize OfficeIMO.OfficeLength? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- linkUri string? = null
- linkContents string? = null
- baseline OfficeIMO.Pdf.PdfTextBaseline = Normal
- linkDestinationName string? = null
- tabLeader OfficeIMO.Pdf.PdfTabLeaderStyle = None
- tabAlignment OfficeIMO.Pdf.PdfTabAlignment = Left
- backgroundColor OfficeIMO.OfficeColor? = null
- fontFamily string? = null
- underlineStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None
- strikeStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None
- decorationColor OfficeIMO.OfficeColor? = null
Methods
public static PdfTextRun Bolded(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a bold run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun BoldItalic(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a bold and italic run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun BoldUnderlined(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a bold and underlined run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun Inline(PdfInlineElement element) #Create an inline visual run.
Parameters
- element OfficeIMO.Pdf.PdfInlineElement
Returns
PdfTextRunpublic static PdfTextRun Italicized(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create an italic run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun Link(string text, string uri, OfficeColor? color = null, bool underline = true, string? contents = null, PdfTextBaseline baseline = Normal, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null, OfficeTextDecorationStyle underlineStyle = None, OfficeTextDecorationStyle strikeStyle = None) #Create a hyperlink run with native decoration styles.
Parameters
- text string
- Link text.
- uri string
- Absolute URI or catalog-base-relative URI.
- color OfficeIMO.OfficeColor? = null
- Optional link color.
- underline bool = true
- Whether to underline the link text.
- contents string? = null
- Optional link annotation contents.
- baseline OfficeIMO.Pdf.PdfTextBaseline = Normal
- Baseline placement for this run.
- fontSize OfficeIMO.OfficeLength? = null
- Optional physical run font size.
- backgroundColor OfficeIMO.OfficeColor? = null
- Optional run background color.
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- Optional standard font for this run.
- fontFamily string? = null
- Optional registered embedded family name. standardFont remains its fallback.
- underlineStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None
- Optional underline pattern.
- strikeStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None
- Optional strikethrough pattern.
Returns
PdfTextRunpublic static PdfTextRun LinkToBookmark(string text, string bookmarkName, OfficeColor? color = null, bool underline = true, string? contents = null, PdfTextBaseline baseline = Normal, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null, OfficeTextDecorationStyle underlineStyle = None, OfficeTextDecorationStyle strikeStyle = None) #Create a hyperlink run that points to a document bookmark with native decoration styles.
Parameters
- text string
- Link text.
- bookmarkName string
- Named destination created with PdfDocument.Bookmark.
- color OfficeIMO.OfficeColor? = null
- Optional link color.
- underline bool = true
- Whether to underline the link text.
- contents string? = null
- Optional link annotation contents.
- baseline OfficeIMO.Pdf.PdfTextBaseline = Normal
- Baseline placement for this run.
- fontSize OfficeIMO.OfficeLength? = null
- Optional physical run font size.
- backgroundColor OfficeIMO.OfficeColor? = null
- Optional run background color.
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- Optional standard font for this run.
- fontFamily string? = null
- Optional registered embedded family name. standardFont remains its fallback.
- underlineStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None
- Optional underline pattern.
- strikeStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None
- Optional strikethrough pattern.
Returns
PdfTextRunpublic static PdfTextRun Normal(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a normal (unstyled) run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic PdfTextRun SetBackgroundColor(OfficeColor color) #Sets the background (highlight) colour of this run.
Parameters
- color OfficeIMO.OfficeColor
Returns
PdfTextRunpublic PdfTextRun SetBaseline(PdfTextBaseline baseline) #Sets the baseline placement of this run.
Parameters
- baseline OfficeIMO.Pdf.PdfTextBaseline
Returns
PdfTextRunpublic PdfTextRun SetBold(bool bold = true) #Makes this run bold or regular weight.
Parameters
- bold bool = true
Returns
PdfTextRunpublic PdfTextRun SetCharacterSpacing(OfficeLength spacing) #Sets the additional advance after each glyph of this text run. Zero is normal spacing.
Parameters
- spacing OfficeIMO.OfficeLength
Returns
PdfTextRunpublic PdfTextRun SetColor(OfficeColor color) #Sets the foreground colour of this run.
Parameters
- color OfficeIMO.OfficeColor
Returns
PdfTextRunpublic PdfTextRun SetFontFamily(string fontFamily) #Sets the registered embedded font family of this run. PdfTextRun.StandardFont remains its fallback.
Parameters
- fontFamily string
Returns
PdfTextRunpublic PdfTextRun SetFontSize(OfficeLength fontSize) #Sets the font size of this run.
Parameters
- fontSize OfficeIMO.OfficeLength
Returns
PdfTextRunpublic PdfTextRun SetHorizontalTextScaling(double percentage) #Sets the horizontal glyph width percentage of this text run. 100 is normal width.
Parameters
- percentage double
Returns
PdfTextRunpublic PdfTextRun SetItalic(bool italic = true) #Makes this run italic or upright.
Parameters
- italic bool = true
Returns
PdfTextRunpublic PdfTextRun SetStandardFont(PdfStandardFont standardFont) #Sets the standard PDF font of this run.
Parameters
- standardFont OfficeIMO.Pdf.PdfStandardFont
Returns
PdfTextRunpublic PdfTextRun SetStrikethrough(bool strikethrough = true) #Adds a single strikethrough to this run, or removes its strikethrough.
Parameters
- strikethrough bool = true
Returns
PdfTextRunpublic PdfTextRun SetStrikethrough(OfficeTextDecorationStyle style) #Sets the strikethrough pattern of this run. OfficeTextDecorationStyle.None removes it.
Parameters
- style OfficeIMO.Drawing.OfficeTextDecorationStyle
Returns
PdfTextRunpublic PdfTextRun SetUnderline(bool underline = true) #Adds a single underline to this run, or removes its underline.
Parameters
- underline bool = true
Returns
PdfTextRunpublic PdfTextRun SetUnderline(OfficeTextDecorationStyle style) #Sets the underline pattern of this run. OfficeTextDecorationStyle.None removes it.
Parameters
- style OfficeIMO.Drawing.OfficeTextDecorationStyle
Returns
PdfTextRunpublic static PdfTextRun Strikethrough(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a strikethrough run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun Subscript(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a subscript run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun Superscript(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create a superscript run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic static PdfTextRun Tab(PdfTabLeaderStyle leader = None, PdfTabAlignment alignment = Left) #Create an explicit paragraph tab run with alignment.
Parameters
- leader OfficeIMO.Pdf.PdfTabLeaderStyle = None
- alignment OfficeIMO.Pdf.PdfTabAlignment = Left
Returns
PdfTextRunpublic static PdfTextRun Underlined(string text, OfficeColor? color = null, OfficeLength? fontSize = null, OfficeColor? backgroundColor = null, PdfStandardFont? standardFont = null, string? fontFamily = null) #Create an underlined run.
Parameters
- text string
- color OfficeIMO.OfficeColor? = null
- fontSize OfficeIMO.OfficeLength? = null
- backgroundColor OfficeIMO.OfficeColor? = null
- standardFont OfficeIMO.Pdf.PdfStandardFont? = null
- fontFamily string? = null
Returns
PdfTextRunpublic PdfTextRun WithCharacterSpacing(OfficeLength spacing) #Creates a copy with additional advance after each rendered glyph, as a physical length.
Parameters
- spacing OfficeIMO.OfficeLength
- Finite positive or negative spacing. Negative values condense the glyph advances.
Returns
PdfTextRunpublic PdfTextRun WithFeatureSettings(OfficeTextFeatureSettings featureSettings) #Creates a copy with explicit OpenType feature selections.
Parameters
- featureSettings OfficeIMO.Drawing.OfficeTextFeatureSettings
Returns
PdfTextRunpublic PdfTextRun WithFootnoteReference(PdfFootnoteDefinition definition) #Creates a copy associated with a footnote while retaining text, typography, spacing, and links.
Parameters
- definition OfficeIMO.Pdf.PdfFootnoteDefinition
Returns
PdfTextRunpublic PdfTextRun WithHorizontalTextScaling(double percentage) #Creates a copy with a positive horizontal glyph width percentage, preserving font height and other formatting.
Parameters
- percentage double
Returns
PdfTextRunpublic PdfTextRun WithTextCase(OfficeTextCase textCase, CultureInfo? culture = null) #Create a copy with transformed text casing while preserving all run formatting and link metadata.
Parameters
- textCase OfficeIMO.Drawing.OfficeTextCase
- culture System.Globalization.CultureInfo? = null
Returns
PdfTextRunInherited Methods
Properties
public OfficeTextDecorationStyle UnderlineStyle { get; private set; } #Underline pattern rendered by the PDF writer.
public OfficeTextDecorationStyle StrikeStyle { get; private set; } #Strikethrough pattern rendered by the PDF writer.
public OfficeColor? DecorationColor { get; } #Optional underline and strikethrough color. Null uses the run foreground color.
public OfficeColor? BackgroundColor { get; private set; } #Optional run background color, useful for highlights.
public OfficeLength? FontSize { get; private set; } #Optional font size for this run. When null, the paragraph font size is used.
public PdfStandardFont? StandardFont { get; private set; } #Optional standard PDF font for this run. When null, the paragraph/document font is used.
public string? FontFamily { get; private set; } #Optional registered embedded font family for this run. This does not consume a standard-font compatibility slot; PdfTextRun.StandardFont remains the fallback when the family is unavailable.
public string? LinkDestinationName { get; } #Optional named destination associated with this run.
public string? LinkContents { get; } #Optional hyperlink annotation contents, used by readers as link metadata.
public PdfTextBaseline Baseline { get; private set; } #Baseline placement for this run.
public PdfTabLeaderStyle TabLeader { get; } #Leader fill used when this run represents a paragraph tab.
public PdfTabAlignment TabAlignment { get; } #Alignment used when this run represents a paragraph tab.
public PdfInlineElement? InlineElement { get; } #Optional inline visual carried by this run instead of text.
public OfficeTextFeatureSettings FeatureSettings { get; private set; } #Optional OpenType feature selections for this run.
public PdfFootnoteDefinition? FootnoteReference { get; private set; } #The page-associated footnote referenced by this run, or null.
public double HorizontalTextScaling { get; private set; } #Horizontal glyph width as a percentage of the selected font's normal width. The default is 100.
public OfficeLength CharacterSpacing { get; private set; } #Additional advance after each rendered glyph, as a physical length. The default is zero.