FormattedText
概述
FormattedText 是 Aspose.PDF FOSS 中用于 .NET 的一个类。
表示在 stamp 和 mend 操作中使用的格式化文本。
此类提供 26 种方法,用于在 .NET 程序中操作 FormattedText 对象。可用的方法包括:AddNewLineText、FormattedText、IsCjk、SetCjkFontStyle。在安装了 Aspose.PDF FOSS for .NET 包后,所有公共成员对任何 .NET 应用程序均可访问。属性包括:BackgroundColor、CustomFontFile、FontName、FontSize、ForegroundColor、IsEmbedded,以及另外 3 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
Text | string | 读取 | 第一行文本内容。 |
FontSize | double | 读写 | 字体大小(以点为单位)。 |
FontName | string | 读写 | 字体名称(PDF 基础字体名称)。 |
ForegroundColor | Color | 读写 | 前景(文本)颜色。 |
BackgroundColor | Color | 读写 | 背景颜色。 |
IsEmbedded | bool | 读写 | 文本是否已嵌入(针对非标准字体)。 |
CustomFontFile | string? | 读写 | 自定义字体文件路径(用于 TrueType 字体嵌入)。 |
TextWidth | float | 读取 | 当前字体和字号下文本的前进宽度,单位为点。 |
TextHeight | float | 读取 | 格式化文本的高度,单位为点。 |
方法
| 签名 | 描述 |
|---|---|
FormattedText() | 创建一个新的 FormattedText,文本为空。 |
FormattedText(text: string) | 创建一个新的 FormattedText,使用指定的文本。 |
FormattedText(text: string, foregroundColor: Color, backgroundColor: Color) | 创建一个 FormattedText,包含文本和前景/背景颜色。 |
FormattedText(text: string, foregroundColor: FontColor) | 创建一个 FormattedText,包含文本和 FontColor 前景/背景。 |
FormattedText(text: string, foregroundColor: FontColor, backgroundColor: FontColor) | 创建一个带有文本和 FontColor 前景/背景的 FormattedText。 |
FormattedText(text: string, fontColor: FontColor, fontStyle: FontStyle, encodingType: EncodingType, embedded: bool, textSize: float) | 使用 FontColor 创建一个具有完整格式的 FormattedText。 |
FormattedText(text: string, textColor: FontColor, backColor: FontColor, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float) | 使用 FontColor 创建一个具有完整格式、包含前景和背景的 FormattedText。 |
FormattedText(text: string, fontColor: FontColor, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | 使用 FontColor 创建一个具有完整格式并带有行间距的 FormattedText。 |
FormattedText(text: string, textColor: Color, backColor: Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | 创建一个 FormattedText,其前景/背景为 System.Drawing.Color,并设置字体。 |
FormattedText(text: string, textColor: Color, backColor: Color, textFont: FontStyle, encoding: EncodingType, embedded: bool, textSize: float) | 创建一个 FormattedText,其前景/背景为 System.Drawing.Color,并使用 FontStyle。 |
FormattedText(text: string, textColor: Color, backColor: Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | 在此 FormattedText 实例上调用 FormattedText(text, textColor, backColor, textFont, textEncoding, embedded, textSize, lineSpacing)。 |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | 在此 FormattedText 实例上调用 FormattedText(text, textColor, backColor, textFont, textEncoding, embedded, textSize, lineSpacing)。 |
FormattedText(text: string, textColor: FontColor, backColor: FontColor, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | 在此 FormattedText 实例上调用 FormattedText(text, textColor, backColor, textFont, textEncoding, embedded, textSize, lineSpacing)。 |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color) | System.Drawing.Color 前景 + 前景/背景 对。 |
FormattedText(text: string, color: System.Drawing.Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float) | System.Drawing.Color 前景 + FontStyle + EncodingType,无 lineSpacing。 |
FormattedText(text: string, textColor: System.Drawing.Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | System.Drawing.Color 前景 + FontStyle + EncodingType + lineSpacing。 |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color, textFont: FontStyle, encoding: EncodingType, embedded: bool, textSize: float) | System.Drawing.Color 前景/背景 + FontStyle。 |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | System.Drawing.Color 前景/背景 + 字体名称字符串。 |
FormattedText(text: string, textColor: System.Drawing.Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | 创建一个 FormattedText,其前景为 System.Drawing.Color,并使用字体名称或 TrueType 字体文件。 |
FormattedText(text: string, textColor: Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | 创建一个 FormattedText,其前景为 Aspose.Pdf.Color,并使用字体名称或 TrueType 字体文件。 |
FormattedText(text: string, color: Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float) | 创建一个 FormattedText,使用 FontStyle (enum) 和 System.Drawing.Color。 |
FormattedText(text: string, textColor: Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | 创建一个 FormattedText,使用 Aspose.Pdf.Color 前景/背景以及行间距。 |
AddNewLineText(newLineText: string) | 添加一行新文本。 |
AddNewLineText(newLineText: string, lineSpacing: float) | 添加一行新文本,并使用自定义行间距。 |
IsCjk() | 检查文本是否包含 CJK 字符。 |
SetCjkFontStyle() | 将字体设置为支持 CJK 的字体(相当于 MS Gothic)。 |