Class Comment

Class Comment

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

ห่อหุ้มวัตถุที่แสดงถึงความคิดเห็นของเซลล์

public class Comment

การสืบทอด

objectComment

สมาชิกที่สืบทอด

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 = "หมายเหตุที่สอง.";

//ทำธุรกิจของคุณ

//บันทึกไฟล์ excel
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; }

ค่า Property

string

ตัวอย่าง

comment1.Author = "Carl.Yang";

ขนาดอัตโนมัติ

ระบุว่าขนาดของความคิดเห็นถูกปรับโดยอัตโนมัติตามเนื้อหา

public bool AutoSize { get; set; }

ค่า Property

bool

ตัวอย่าง

if(!comment1.AutoSize)
{
    //ขนาดของความคิดเห็นจะแตกต่างตามเนื้อหา
    comment1.AutoSize = true;
}

คอลัมน์

รับดัชนีคอลัมน์ของความคิดเห็น

public int Column { get; }

ค่า Property

int

ตัวอย่าง

int column = comment1.Column;

รูปร่างความคิดเห็น

รับวัตถุ Shape ที่แสดงถึงรูปร่างที่แนบมากับความคิดเห็นที่ระบุ

public CommentShape CommentShape { get; }

ค่า Property

CommentShape

ตัวอย่าง

CommentShape shape = comment1.CommentShape;
int w = shape.Width;
int h = shape.Height;

ฟอนต์

รับฟอนต์ของความคิดเห็น

public Font Font { get; }

ค่า Property

Font

ตัวอย่าง

Aspose.Cells.Font font = comment1.Font;
font.Size = 12;

ความสูง

แสดงถึงความสูงของความคิดเห็น หน่วยเป็นพิกเซล

public int Height { get; set; }

ค่า Property

int

ตัวอย่าง

comment1.Height = 10;

ความสูง (ซม.)

แสดงถึงความสูงของความคิดเห็น หน่วยเป็นเซนติเมตร

public double HeightCM { get; set; }

ค่า Property

double

ตัวอย่าง

comment1.HeightCM = 1.0;

ความสูง (นิ้ว)

แสดงถึงความสูงของความคิดเห็น หน่วยเป็นนิ้ว

public double HeightInch { get; set; }

ค่า Property

double

ตัวอย่าง

comment1.HeightInch = 1.0;

หมายเหตุ HTML

รับและตั้งค่า html string ที่มีข้อมูลและรูปแบบบางอย่างในความคิดเห็นนี้

public string HtmlNote { get; set; }

ค่า Property

string

ตัวอย่าง

comment1.HtmlNote = "<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>นี่คือ <b>การทดสอบ</b>.</Font>";

หมายเหตุ

ถ้านี่คือความคิดเห็นแบบเธรด หมายเหตุนั้นไม่สามารถเปลี่ยนแปลงได้ มิฉะนั้น MS Excel จะไม่สามารถประมวลผลเป็นความคิดเห็นแบบเธรดได้

เป็นความคิดเห็นแบบเธรด

ระบุว่านี่คือความคิดเห็นแบบเธรดหรือไม่

public bool IsThreadedComment { get; }

ค่า Property

bool

ตัวอย่าง

if(comment1.IsThreadedComment)
{
    //ความคิดเห็นนี้เป็นความคิดเห็นแบบเธรด
}

มองเห็นได้

แสดงว่าความคิดเห็นมองเห็นได้หรือไม่

public bool IsVisible { get; set; }

ค่า Property

bool

ตัวอย่าง

if(comment1.IsVisible)
{
    //ความคิดเห็นมองเห็นได้
}

หมายเหตุ

แสดงถึงเนื้อหาของความคิดเห็น

public string Note { get; set; }

ค่า Property

string

ตัวอย่าง

comment1.Note = "หมายเหตุแรก.";

หมายเหตุ

ถ้านี่คือความคิดเห็นแบบเธรด หมายเหตุนั้นไม่สามารถเปลี่ยนแปลงได้ มิฉะนั้น MS Excel จะไม่สามารถประมวลผลเป็นความคิดเห็นแบบเธรดได้

แถว

รับดัชนีแถวของความคิดเห็น

public int Row { get; }

ค่า Property

int

ตัวอย่าง

int row = comment1.Row;

การจัดแนวข้อความแนวนอน

รับและตั้งค่าประเภทการจัดแนวข้อความแนวนอนของความคิดเห็น

public TextAlignmentType TextHorizontalAlignment { get; set; }

ค่า Property

TextAlignmentType

ตัวอย่าง

if (comment1.TextHorizontalAlignment ==  TextAlignmentType.Fill)
{
    comment1.TextHorizontalAlignment = TextAlignmentType.Center;
}

ประเภทการจัดแนวข้อความ

รับและตั้งค่าประเภทการจัดแนวข้อความของความคิดเห็น

public TextOrientationType TextOrientationType { get; set; }

ค่า Property

TextOrientationType

ตัวอย่าง

if(comment1.TextOrientationType == TextOrientationType.NoRotation)
{
    comment1.TextOrientationType = TextOrientationType.TopToBottom;
}

การจัดแนวข้อความแนวตั้ง

รับและตั้งค่าประเภทการจัดแนวข้อความแนวตั้งของความคิดเห็น

public TextAlignmentType TextVerticalAlignment { get; set; }

ค่า Property

TextAlignmentType

ตัวอย่าง

if (comment1.TextVerticalAlignment ==  TextAlignmentType.Fill)
{
    comment1.TextVerticalAlignment = TextAlignmentType.Center;
}

ความคิดเห็นแบบเธรด

รับรายการความคิดเห็นแบบเธรด

public ThreadedCommentCollection ThreadedComments { get; }

ค่า Property

ThreadedCommentCollection

ตัวอย่าง

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; }

ค่า Property

int

ตัวอย่าง

comment1.Width = 10;

ความกว้าง (ซม.)

แสดงถึงความกว้างของความคิดเห็น หน่วยเป็นเซนติเมตร

public double WidthCM { get; set; }

ค่า Property

double

ตัวอย่าง

comment1.WidthCM = 1.0;

ความกว้าง (นิ้ว)

แสดงถึงความกว้างของความคิดเห็น หน่วยเป็นนิ้ว

public double WidthInch { get; set; }

ค่า Property

double

ตัวอย่าง

comment1.WidthInch = 1.0;

วิธีการ

ตัวอักษร(int, int)

คืนค่าวัตถุ Characters ที่แสดงถึงช่วงของตัวอักษรในข้อความความคิดเห็น

public FontSetting Characters(int startIndex, int length)

พารามิเตอร์

startIndex int

ดัชนีเริ่มต้นของตัวอักษร

length int

จำนวนตัวอักษร

คืนค่า

FontSetting

วัตถุ Characters

ตัวอย่าง

Aspose.Cells.FontSetting fontSetting = comment1.Characters(0, 4);

ฟอร์แมตตัวอักษร(int, int, ฟอนต์, StyleFlag)

ฟอร์แมตตัวอักษรบางตัวด้วยการตั้งค่าฟอนต์

public void FormatCharacters(int startIndex, int length, Font font, StyleFlag flag)

พารามิเตอร์

startIndex int

ดัชนีเริ่มต้น

length int

ความยาว

font Font

การตั้งค่าฟอนต์

flag StyleFlag

ธงของการตั้งค่าฟอนต์

รับการจัดรูปแบบที่มีความหมาย()

คืนค่าทั้งหมดวัตถุ Characters ที่แสดงถึงช่วงของตัวอักษรในข้อความความคิดเห็น

public FontSetting[] GetRichFormattings()

คืนค่า

FontSetting[]

วัตถุ Characters ทั้งหมด

ตัวอย่าง

FontSetting[] list = comment1.GetRichFormattings();
 แบบไทย