Class Comment
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
encapsulates את האובייקט המייצג הערת תא.
public class Comment
ירושה
חברים שהורשו
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
דוגמאות
Workbook workbook = new Workbook();
CommentCollection comments = workbook.Worksheets[0].Comments;
//הוסף הערה לתא A1
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "הערה ראשונה.";
comment1.Font.Name = "Times New Roman";
//הוסף הערה לתא B2
comments.Add("B2");
Comment comment2 = comments["B2"];
comment2.Note = "הערה שנייה.";
//בצע את העסקים שלך
//שמור את קובץ האקסל.
workbook.Save("exmaple.xlsx");
Dim workbook as Workbook = new Workbook()
Dim comments as CommentCollection = workbook.Worksheets(0).Comments
'הוסף הערה לתא A1
Dim commentIndex1 as Integer = comments.Add(0, 0)
Dim comment1 as Comment = comments(commentIndex1)
comment1.Note = "הערה ראשונה."
comment1.Font.Name = "Times New Roman"
'הוסף הערה לתא B2
comments.Add("B2")
Dim comment2 As Comment = comments("B2")
comment2.Note = "הערה שנייה."
מאפיינים
מחבר
מקבל ומגדיר את שם מחבר ההערה המקורי
public string Author { get; set; }
ערך מאפיין
דוגמאות
comment1.Author = "Carl.Yang";
גודל אוטומטי
מציין אם גודל ההערה מותאם אוטומטית בהתאם לתוכן שלה.
public bool AutoSize { get; set; }
ערך מאפיין
דוגמאות
if(!comment1.AutoSize)
{
//גודל ההערה משתנה עם התוכן
comment1.AutoSize = true;
}
עמודה
מקבל את אינדקס העמודה של ההערה.
public int Column { get; }
ערך מאפיין
דוגמאות
int column = comment1.Column;
צורת הערה
מקבל אובייקט Shape המייצג את הצורה הקשורה להערה הספציפית.
public CommentShape CommentShape { get; }
ערך מאפיין
דוגמאות
CommentShape shape = comment1.CommentShape;
int w = shape.Width;
int h = shape.Height;
גופן
מקבל את הגופן של ההערה.
public Font Font { get; }
ערך מאפיין
דוגמאות
Aspose.Cells.Font font = comment1.Font;
font.Size = 12;
גובה
מייצג את גובה ההערה, ביחידות של פיקסלים.
public int Height { get; set; }
ערך מאפיין
דוגמאות
comment1.Height = 10;
גובה ס"מ
מייצג את גובה ההערה, ביחידות של סנטימטרים.
public double HeightCM { get; set; }
ערך מאפיין
דוגמאות
comment1.HeightCM = 1.0;
גובה אינצ’ים
מייצג את גובה ההערה, ביחידות של אינצ’ים.
public double HeightInch { get; set; }
ערך מאפיין
דוגמאות
comment1.HeightInch = 1.0;
HtmlNote
מקבל ומגדיר את המיתר HTML המכיל נתונים וכמה פורמטים בהערה זו.
public string HtmlNote { get; set; }
ערך מאפיין
דוגמאות
comment1.HtmlNote = "<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>This is a <b>test</b>.</Font>";
הערות
אם זו הערה מחוברת, לא ניתן לשנות את ההערה, אחרת MS Excel לא יכול היה לעבד אותה כהערה מחוברת.
IsThreadedComment
מציין אם ההערה הזו היא הערה מחוברת.
public bool IsThreadedComment { get; }
ערך מאפיין
דוגמאות
if(comment1.IsThreadedComment)
{
//ההערה הזו היא הערה מחוברת.
}
IsVisible
מייצג אם ההערה נראית או לא.
public bool IsVisible { get; set; }
ערך מאפיין
דוגמאות
if(comment1.IsVisible)
{
//ההערה נראית
}
הערה
מייצג את תוכן ההערה.
public string Note { get; set; }
ערך מאפיין
דוגמאות
comment1.Note = "הערה ראשונה.";
הערות
אם זו הערה מחוברת, לא ניתן לשנות את ההערה, אחרת MS Excel לא יכול היה לעבד אותה כהערה מחוברת.
שורה
מקבל את אינדקס השורה של ההערה.
public int Row { get; }
ערך מאפיין
דוגמאות
int row = comment1.Row;
TextHorizontalAlignment
מקבל ומגדיר את סוג יישור הטקסט ההוריזונטלי של ההערה.
public TextAlignmentType TextHorizontalAlignment { get; set; }
ערך מאפיין
דוגמאות
if (comment1.TextHorizontalAlignment == TextAlignmentType.Fill)
{
comment1.TextHorizontalAlignment = TextAlignmentType.Center;
}
TextOrientationType
מקבל ומגדיר את סוג כיוון הטקסט של ההערה.
public TextOrientationType TextOrientationType { get; set; }
ערך מאפיין
דוגמאות
if(comment1.TextOrientationType == TextOrientationType.NoRotation)
{
comment1.TextOrientationType = TextOrientationType.TopToBottom;
}
TextVerticalAlignment
מקבל ומגדיר את סוג יישור הטקסט האנכי של ההערה.
public TextAlignmentType TextVerticalAlignment { get; set; }
ערך מאפיין
דוגמאות
if (comment1.TextVerticalAlignment == TextAlignmentType.Fill)
{
comment1.TextVerticalAlignment = TextAlignmentType.Center;
}
ThreadedComments
מקבל את רשימת ההערות המחוברות;
public ThreadedCommentCollection ThreadedComments { get; }
ערך מאפיין
דוגמאות
ThreadedCommentCollection threadedComments = comment1.ThreadedComments;
for (int i = 0; i < threadedComments.Count; ++i)
{
ThreadedComment tc = threadedComments[i];
string note = tc.Notes;
}
Width
מייצג את רוחב ההערה, ביחידות של פיקסלים.
public int Width { get; set; }
ערך מאפיין
דוגמאות
comment1.Width = 10;
WidthCM
מייצג את רוחב ההערה, ביחידות של סנטימטרים.
public double WidthCM { get; set; }
ערך מאפיין
דוגמאות
comment1.WidthCM = 1.0;
WidthInch
מייצג את רוחב ההערה, ביחידות של אינצ’ים.
public double WidthInch { get; set; }
ערך מאפיין
דוגמאות
comment1.WidthInch = 1.0;
שיטות
Characters(int, int)
מחזיר אובייקט Characters המייצג טווח של תווים בתוך טקסט ההערה.
public FontSetting Characters(int startIndex, int length)
פרמטרים
startIndex
int
האינדקס של תחילת התו.
length
int
מספר התווים.
מחזיר
אובייקט Characters.
דוגמאות
Aspose.Cells.FontSetting fontSetting = comment1.Characters(0, 4);
FormatCharacters(int, int, Font, StyleFlag)
מעצב כמה תווים עם הגדרת הגופן.
public void FormatCharacters(int startIndex, int length, Font font, StyleFlag flag)
פרמטרים
startIndex
int
האינדקס ההתחלתי.
length
int
האורך.
font
Font
הגדרת הגופן.
flag
StyleFlag
הדגל של הגדרת הגופן.
GetRichFormattings()
מחזיר את כל אובייקטי Characters המייצגים טווח של תווים בתוך טקסט ההערה.
public FontSetting[] GetRichFormattings()
מחזיר
כל אובייקטי Characters
דוגמאות
FontSetting[] list = comment1.GetRichFormattings();