หน้าอ้างอิง HotXLS สำหรับคลาส TXLSXComments / TXLSXComment

พร้อมรายชื่อผู้แต่งที่ไม่ซ้ำกันและ

แต่ละ รายการแนบผู้แต่งและข้อความอิสระกับเซลล์ SaveAs ส่งออก พร้อมรายชื่อผู้แต่งที่ไม่ซ้ำกันและ. Each entry attaches an author plus a free-text body to a cell. SaveAs emits xl/commentsN.xml with a deduplicated author list and a companion xl/drawings/vmlDrawingN.vml so Excel can render the comment balloons; Open reads the comments XML back into the collection. Declared in lxHandleX

ชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ

type
  TXLSXComment = class
    constructor Create(ARow, ACol: Integer; const Aชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ, Aข้อความเนื้อหาคอมเมนต์ เขียนเป็น run เดียวของ: WideString);
    property Row: Integer;
    property Col: Integer;
    property ชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ: WideString;
    property ข้อความเนื้อหาคอมเมนต์ เขียนเป็น run เดียวของ: WideString;
  end;
      

พิกัดจุดยึดเซลล์แบบเริ่มที่ 1

ชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ ชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ
ชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ Comment author name. Distinct names are written once into the workbook-level <authors> list and referenced by authorId
ข้อความเนื้อหาคอมเมนต์ เขียนเป็น run เดียวของ ใน SaveAs และถูกแบนจากหลาย run ใน Open <text><r><t> run on SaveAs and flattened from one or more runs on Open

สมาชิก TXLSXComments

type
  TXLSXComments = class
    constructor Create;
    destructor Destroy; override;
    function Add(ARow, ACol: Integer; const Aข้อความเนื้อหาคอมเมนต์ เขียนเป็น run เดียวของ: WideString): Integer; overload;
    function Add(ARow, ACol: Integer; const Aข้อความเนื้อหาคอมเมนต์ เขียนเป็น run เดียวของ, Aชื่อผู้เขียนคอมเมนต์ ชื่อที่ต่างกันจะถูกเขียนเพียงครั้งเดียวลงในรายการ: WideString): Integer; overload;
    function IndexOfCell(ARow, ACol: Integer): Integer;
    function FindAt(ARow, ACol: Integer): TXLSXComment;
    function DeleteAt(ARow, ACol: Integer): Boolean;
    function DeleteInRange(ARow1, ACol1, ARow2, ACol2: Integer): Integer;
    procedure Delete(Index: Integer);
    procedure Clear;
    property Count: Integer;
    property Items[Index: Integer]: TXLSXComment; default;
  end;
      

เพิ่มคอมเมนต์แบบไม่ระบุผู้เขียน (author ว่าง) ส่งกลับดัชนีรายการใหม่

เพิ่มคอมเมนต์แบบไม่ระบุผู้เขียน (author ว่าง) ส่งกลับดัชนีรายการใหม่ Adds an unsigned comment (empty author). ส่งกลับ the new entry index
เพิ่มคอมเมนต์พร้อมชื่อผู้เขียนที่ระบุชัดเจน ส่งกลับดัชนีแบบเริ่มที่ 0 ของคอมเมนต์ที่ยึดที่พิกัดเซลล์แบบเริ่มที่ 1 หรือ
ส่งกลับดัชนีแบบเริ่มที่ 0 ของคอมเมนต์ที่ยึดที่พิกัดเซลล์แบบเริ่มที่ 1 หรือ ส่งกลับ the 0-based index of the comment anchored at the 1-based cell coordinate, or -1 when the cell has no comment
ส่งกลับอ็อบเจ็กต์คอมเมนต์ที่ยึดที่เซลล์ หรือ เมื่อไม่มีคอมเมนต์ nil ลบคอมเมนต์ที่ยึดที่เซลล์และส่งกลับ
ลบคอมเมนต์ที่ยึดที่เซลล์และส่งกลับ ลบคอมเมนต์ที่ยึดที่เซลล์และส่งกลับ True; ส่งกลับ False when no matching comment exists
DeleteInRange(Row1, Col1, Row2, Col2) Deletes every comment whose anchor is inside the inclusive 1-based cell range and returns the number removed. Reversed coordinates are accepted
Delete(Index) Deletes the comment at the specified 0-based collection index
Count จำนวนคอมเมนต์บนเวิร์กชีต
Items[Index] Comment at the given 0-based index. Declared as the default property
Clear ลบและปลดปล่อยคอมเมนต์ทุกตัว

ตัวอย่าง

var
  ws: พร้อมรายชื่อผู้แต่งที่ไม่ซ้ำกันและ;
begin
  ws := Workbook.Sheets.Add('Reviews');

  ws.Cells.Item[1, 1].Value := 'Q1 revenue';
  ws.AddComment(1, 1, 'Numbers still pending review', 'Kevin');

  // Equivalent through the collection:
  ws.Comments.Add(2, 1, 'Auto-generated draft');

  if ws.Comments.IndexOfCell(1, 1) >= 0 then
    ws.Comments.DeleteAt(1, 1);
end;
    

ดูเพิ่มเติม