Class FontSettingCollection
Contents
[
Hide
]FontSettingCollection class
Represents the list of FontSetting
.
public class FontSettingCollection : CollectionBase<FontSetting>
Properties
Name | Description |
---|---|
Capacity { get; set; } | |
Count { get; } | |
HtmlString { get; set; } | Gets and sets the html string which contains data and some formats in this shape. |
Item { get; } | Gets the FontSetting by the index. |
Item { get; set; } | |
Text { get; set; } | Gets and sets the text of the shape. |
TextAlignment { get; } | Represents the alignment setting of the text body. |
TextParagraphs { get; } | Gets all paragraphs. |
Methods
Name | Description |
---|---|
AppendText(string) | Appends the text. |
BinarySearch(FontSetting) | |
BinarySearch(FontSetting, IComparer<FontSetting>) | |
BinarySearch(int, int, FontSetting, IComparer<FontSetting>) | |
Clear() | Clear all setting. (2 methods) |
Contains(FontSetting) | |
CopyTo(FontSetting[]) | |
CopyTo(FontSetting[], int) | |
CopyTo(int, FontSetting[], int, int) | |
DeleteText(int, int) | Delete some characters. |
override Equals(object) | |
Exists(Predicate<FontSetting>) | |
Find(Predicate<FontSetting>) | |
FindAll(Predicate<FontSetting>) | |
FindIndex(Predicate<FontSetting>) | |
FindIndex(int, Predicate<FontSetting>) | |
FindIndex(int, int, Predicate<FontSetting>) | |
FindLast(Predicate<FontSetting>) | |
FindLastIndex(Predicate<FontSetting>) | |
FindLastIndex(int, Predicate<FontSetting>) | |
FindLastIndex(int, int, Predicate<FontSetting>) | |
Format(int, int, Font, StyleFlag) | Format the text with font setting. |
GetEnumerator() | |
override GetHashCode() | |
GetParagraphEnumerator() | Gets the enumerator of the paragraphs. |
IndexOf(FontSetting) | |
IndexOf(FontSetting, int) | |
IndexOf(FontSetting, int, int) | |
InsertText(int, string) | Insert index at the position. |
LastIndexOf(FontSetting) | |
LastIndexOf(FontSetting, int) | |
LastIndexOf(FontSetting, int, int) | |
RemoveAt(int) | |
Replace(string, string) | Replace the text. |
Replace(int, int, string) | Replace the text. |
SetWordArtStyle(PresetWordArtStyle) | Sets the preset WordArt style. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Drawing.Texts;
using System;
public class TextsClassFontSettingCollectionDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Add a text box to the worksheet
var textBox = worksheet.Shapes.AddTextBox(0, 0, 100, 100, 200, 200);
var fontSettings = textBox.TextBody;
// Set initial text
fontSettings.Text = "Initial Text";
Console.WriteLine("Initial Text: " + fontSettings.Text);
// Append text
fontSettings.AppendText("\nAppended Text");
Console.WriteLine("After Append: " + fontSettings.Text);
// Insert text
fontSettings.InsertText(7, "Inserted ");
Console.WriteLine("After Insert: " + fontSettings.Text);
// Replace text by position
fontSettings.Replace(0, 7, "Modified");
Console.WriteLine("After Position Replace: " + fontSettings.Text);
// Replace text by value
fontSettings.Replace("Appended", "Replaced");
Console.WriteLine("After Value Replace: " + fontSettings.Text);
// Format text
Style style = workbook.CreateStyle();
style.Font.Name = "Arial";
style.Font.Size = 14;
style.Font.Color = System.Drawing.Color.Red;
StyleFlag flag = new StyleFlag();
flag.FontName = true;
flag.FontSize = true;
flag.FontColor = true;
fontSettings.Format(0, 8, style.Font, flag);
// Demonstrate HTML string
fontSettings.HtmlString = "<b>Bold HTML</b> <i>Italic HTML</i>";
Console.WriteLine("HTML String: " + fontSettings.HtmlString);
// Access text paragraphs
var paragraphs = fontSettings.TextParagraphs;
Console.WriteLine("Paragraph Count: " + paragraphs.Count);
// Set WordArt style
fontSettings.SetWordArtStyle(PresetWordArtStyle.WordArtStyle1);
// Save the workbook
workbook.Save("TextsClassFontSettingCollectionDemo.xlsx");
}
}
}
See Also
- class CollectionBase<T>
- class FontSetting
- namespace Aspose.Cells.Drawing.Texts
- assembly Aspose.Cells