Class Comment
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
شیء را که نمایانگر یک نظر در سلول است، محصور میکند.
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;
شکل نظر
یک شیء شکل را که نمایانگر شکل متصل به نظر مشخص شده است، دریافت میکند.
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;'>این یک <b>آزمایش</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;
}
عرض
عرض نظر را به واحد پیکسل نمایان میکند.
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();