Compatibilidad con comentarios de celda en un TXLSXWorksheet. Cada entrada adjunta un autor y un cuerpo de texto libre a una celda identificada por su fila y columna
Declaracion de 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;
Miembros de TXLSXComment
| Row, Col |
1-basado celda anchor coordinates |
| Author |
Nombre del autor del comentario. Los nombres distintos se escriben una sola vez en la lista de todo el libro y se referencian por authorId |
| Text |
Texto del cuerpo del comentario. Se escribe como una sola ejecución al guardar con SaveAs y se aplana desde una o varias ejecuciones al abrir |
Declaracion de 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;
Miembros de TXLSXComments
| Add(Row, Col, Text) |
Agrega un comentario sin firma (autor vacío). Devuelve el nuevo índice de entrada |
| Add(Row, Col, Text, Author) |
Agrega un comentario con un nombre de autor explícito |
| IndexOfCell(Row, Col) |
Devuelve el índice 0-based del comentario anclado en la coordenada de celda 1-based, o -1 cuando la celda no tiene comentario |
| FindAt(Row, Col) |
Devuelve el objeto comentario anclado a la celda, o nil cuando no hay comentario presente |
| DeleteAt(Row, Col) |
Elimina el comentario anclado en la celda y devuelve True; devuelve False cuando no existe ningún comentario coincidente |
| DeleteInRange(Row1, Col1, Row2, Col2) |
Elimina todos los comentarios cuyo anclaje esté dentro del rango de celdas inclusivo basado en 1 y devuelve el número eliminado. Se aceptan coordenadas invertidas |
| Delete(Index) |
Elimina el comentario en el índice de colección especificado basado en 0 |
| Count |
Número de comentarios en la hoja de cálculo |
| Items[Index] |
Comentario en el índice basado en 0 dado. Declarado como la propiedad predeterminada |
| Clear |
Elimina y libera todos los comentarios |
Ejemplo
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;
Vease tambien