Class Comment
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Kapselt das Objekt, das einen Zellkommentar darstellt.
public class Comment
Vererbung
Vererbte Mitglieder
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Beispiele
Workbook workbook = new Workbook();
CommentCollection comments = workbook.Worksheets[0].Comments;
//Kommentar zur Zelle A1 hinzufügen
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "Erste Notiz.";
comment1.Font.Name = "Times New Roman";
//Kommentar zur Zelle B2 hinzufügen
comments.Add("B2");
Comment comment2 = comments["B2"];
comment2.Note = "Zweite Notiz.";
//Ihr Geschäft erledigen
//Die Excel-Datei speichern.
workbook.Save("exmaple.xlsx");
Dim workbook as Workbook = new Workbook()
Dim comments as CommentCollection = workbook.Worksheets(0).Comments
'Kommentar zur Zelle A1 hinzufügen
Dim commentIndex1 as Integer = comments.Add(0, 0)
Dim comment1 as Comment = comments(commentIndex1)
comment1.Note = "Erste Notiz."
comment1.Font.Name = "Times New Roman"
'Kommentar zur Zelle B2 hinzufügen
comments.Add("B2")
Dim comment2 As Comment = comments("B2")
comment2.Note = "Zweite Notiz."
Eigenschaften
Author
Erhält und setzt den Namen des ursprünglichen Kommentarschreibers.
public string Author { get; set; }
Eigenschaftswert
Beispiele
comment1.Author = "Carl.Yang";
AutoSize
Gibt an, ob die Größe des Kommentars automatisch an den Inhalt angepasst wird.
public bool AutoSize { get; set; }
Eigenschaftswert
Beispiele
if(!comment1.AutoSize)
{
//Die Größe des Kommentars variiert mit dem Inhalt
comment1.AutoSize = true;
}
Column
Erhält den Spaltenindex des Kommentars.
public int Column { get; }
Eigenschaftswert
Beispiele
int column = comment1.Column;
CommentShape
Erhält ein Shape-Objekt, das die Form darstellt, die dem angegebenen Kommentar angehängt ist.
public CommentShape CommentShape { get; }
Eigenschaftswert
Beispiele
CommentShape shape = comment1.CommentShape;
int w = shape.Width;
int h = shape.Height;
Font
Erhält die Schriftart des Kommentars.
public Font Font { get; }
Eigenschaftswert
Beispiele
Aspose.Cells.Font font = comment1.Font;
font.Size = 12;
Height
Stellt die Höhe des Kommentars in Pixeln dar.
public int Height { get; set; }
Eigenschaftswert
Beispiele
comment1.Height = 10;
HeightCM
Stellt die Höhe des Kommentars in Zentimetern dar.
public double HeightCM { get; set; }
Eigenschaftswert
Beispiele
comment1.HeightCM = 1.0;
HeightInch
Stellt die Höhe des Kommentars in Zoll dar.
public double HeightInch { get; set; }
Eigenschaftswert
Beispiele
comment1.HeightInch = 1.0;
HtmlNote
Erhält und setzt den HTML-String, der Daten und einige Formate in diesem Kommentar enthält.
public string HtmlNote { get; set; }
Eigenschaftswert
Beispiele
comment1.HtmlNote = "<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>Dies ist ein <b>Test</b>.</Font>";
Anmerkungen
Wenn dies ein threadbezogener Kommentar ist, kann die Notiz nicht geändert werden, andernfalls kann MS Excel ihn nicht als threadbezogenen Kommentar verarbeiten.
IsThreadedComment
Gibt an, ob dieser Kommentar ein threadbezogener Kommentar ist.
public bool IsThreadedComment { get; }
Eigenschaftswert
Beispiele
if(comment1.IsThreadedComment)
{
//Dieser Kommentar ist ein threadbezogener Kommentar.
}
IsVisible
Stellt dar, ob der Kommentar sichtbar ist oder nicht.
public bool IsVisible { get; set; }
Eigenschaftswert
Beispiele
if(comment1.IsVisible)
{
//Der Kommentar ist sichtbar
}
Note
Stellt den Inhalt des Kommentars dar.
public string Note { get; set; }
Eigenschaftswert
Beispiele
comment1.Note = "Erste Notiz.";
Anmerkungen
Wenn dies ein threadbezogener Kommentar ist, kann die Notiz nicht geändert werden, andernfalls kann MS Excel ihn nicht als threadbezogenen Kommentar verarbeiten.
Row
Erhält den Zeilenindex des Kommentars.
public int Row { get; }
Eigenschaftswert
Beispiele
int row = comment1.Row;
TextHorizontalAlignment
Erhält und setzt den horizontalen Ausrichtungstyp des Kommentars.
public TextAlignmentType TextHorizontalAlignment { get; set; }
Eigenschaftswert
Beispiele
if (comment1.TextHorizontalAlignment == TextAlignmentType.Fill)
{
comment1.TextHorizontalAlignment = TextAlignmentType.Center;
}
TextOrientationType
Erhält und setzt den Textorientierungstyp des Kommentars.
public TextOrientationType TextOrientationType { get; set; }
Eigenschaftswert
Beispiele
if(comment1.TextOrientationType == TextOrientationType.NoRotation)
{
comment1.TextOrientationType = TextOrientationType.TopToBottom;
}
TextVerticalAlignment
Erhält und setzt den vertikalen Ausrichtungstyp des Kommentars.
public TextAlignmentType TextVerticalAlignment { get; set; }
Eigenschaftswert
Beispiele
if (comment1.TextVerticalAlignment == TextAlignmentType.Fill)
{
comment1.TextVerticalAlignment = TextAlignmentType.Center;
}
ThreadedComments
Erhält die Liste der threadbezogenen Kommentare;
public ThreadedCommentCollection ThreadedComments { get; }
Eigenschaftswert
Beispiele
ThreadedCommentCollection threadedComments = comment1.ThreadedComments;
for (int i = 0; i < threadedComments.Count; ++i)
{
ThreadedComment tc = threadedComments[i];
string note = tc.Notes;
}
Width
Stellt die Breite des Kommentars in Pixeln dar.
public int Width { get; set; }
Eigenschaftswert
Beispiele
comment1.Width = 10;
WidthCM
Stellt die Breite des Kommentars in Zentimetern dar.
public double WidthCM { get; set; }
Eigenschaftswert
Beispiele
comment1.WidthCM = 1.0;
WidthInch
Stellt die Breite des Kommentars in Zoll dar.
public double WidthInch { get; set; }
Eigenschaftswert
Beispiele
comment1.WidthInch = 1.0;
Methoden
Characters(int, int)
Gibt ein Characters-Objekt zurück, das einen Bereich von Zeichen innerhalb des Kommentartextes darstellt.
public FontSetting Characters(int startIndex, int length)
Parameter
startIndex
int
Der Index des Anfangs des Zeichens.
length
int
Die Anzahl der Zeichen.
Gibt zurück
Characters-Objekt.
Beispiele
Aspose.Cells.FontSetting fontSetting = comment1.Characters(0, 4);
FormatCharacters(int, int, Font, StyleFlag)
Formatieren Sie einige Zeichen mit den Schriftarteinstellungen.
public void FormatCharacters(int startIndex, int length, Font font, StyleFlag flag)
Parameter
startIndex
int
Der Startindex.
length
int
Die Länge.
font
Font
Die Schriftarteinstellung.
flag
StyleFlag
Das Flag der Schriftarteinstellung.
GetRichFormattings()
Gibt alle Characters-Objekte zurück, die einen Bereich von Zeichen innerhalb des Kommentartextes darstellen.
public FontSetting[] GetRichFormattings()
Gibt zurück
Alle Characters-Objekte.
Beispiele
FontSetting[] list = comment1.GetRichFormattings();