HotXLS 문서

TXLSXComments / TXLSXComment 클래스

Cell-comment support on a TXLSXWorksheet의 셀 메모 지원. 각 항목은 작성자와 자유 텍스트 본문을 셀에 연결합니다. SaveAs는 중복 제거된 작성자 목록이 포함된 xl/commentsN.xml 과 Excel이 메모 말풍선을 렌더링할 수 있도록 하는 동반 xl/drawings/vmlDrawingN.vml 을 방출합니다. Open은 메모 XML을 다시 컬렉션으로 읽습니다. lxHandleX

TXLSXComment 선언

type
  TXLSXComment = class
    constructor Create(ARow, ACol: Integer; const AAuthor, AText: WideString);
    property Row: Integer;
    property Col: Integer;
    property Author: WideString;
    property Text: WideString;
  end;
      

TXLSXComment 멤버

Row, Col1-기반 셀 anchor coordinates
AuthorComment 작성자 이름입니다 서로 다른 이름은 workbook 수준의 <authors> 목록에 한 번만 기록되고 authorId로 참조됩니다 <authors> list and referenced by authorId
TextComment body text. Written as a single <text><r><t> Comment 본문 텍스트입니다 SaveAs 시 단일 <text><r><t> run으로 기록되며 Open 시 하나 이상의 run에서 평탄화됩니다

TXLSXComments 선언

type
  TXLSXComments = class
    constructor Create;
    destructor Destroy; override;
    function Add(ARow, ACol: Integer; const AText: WideString): Integer; overload;
    function Add(ARow, ACol: Integer; const AText, AAuthor: 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;
      

TXLSXComments 멤버

Add(Row, Col, Text)비어 있는 작성자 주석을 추가합니다 새 항목 인덱스를 반환합니다
Add(Row, Col, Text, Author)명시적인 작성자 이름이 포함된 주석을 추가합니다
IndexOfCell(Row, Col)1부터 시작하는 셀 좌표에 고정된 주석의 0부터 시작하는 인덱스를 반환하며 셀에 주석이 없으면 -1을 반환합니다 -1 when the cell has no comment
FindAt(Row, Col)셀에 고정된 주석 객체를 반환하며 주석이 없으면 nil을 반환합니다 nil when no comment is present
DeleteAt(Row, Col)해당 셀에 앵커된 주석을 삭제하고 다음을 반환합니다 True; returns False 셀에 고정된 comment를 삭제하고 True를 반환합니다 일치하는 comment가 없으면 False를 반환합니다
DeleteInRange(Row1, Col1, Row2, Col2)앵커가 포함된 inclusive 1부터 시작하는 셀 범위 안의 모든 comment를 삭제하고 제거한 개수를 반환합니다 반전된 좌표도 허용됩니다
Delete(Index)지정된 0부터 시작하는 collection index의 comment를 삭제합니다
Count워크시트의 댓글 수입니다
Items[Index]지정된 0부터 시작하는 인덱스의 Comment입니다 기본 속성으로 선언되어 있습니다
Clear모든 댓글을 제거하고 해제합니다

예제

var
  ws: TXLSXWorksheet;
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;
    

참조