Table of Contents

TXlsFile.CommentRowCount Method

Maximum row index including comments.

Remarks

There are 2 groups of Comment related methods. One is used when you want to find out on a loop all existing comments on a range, and the other is used to get/set comments at a specified position (row and col). To loop among all existing comments, you can use CommentRowCount together with TExcelFile.CommentCountRow. Do not confuse them, even when they have similar names. CommentRowCount returns the maximum row with a comment, and TExcelFile.CommentCountRow returns the number of comments in a given row.

Syntax

Unit: FlexCel.XlsAdapter

function TXlsFile.CommentRowCount: Integer; override;

Examples

You can loop on all the comments on a sheet with the following code:

var
  row: Int32;
  commentIndex: Int32;
...
  for row := 1 to xls.CommentRowCount do
  begin
    for commentIndex := 1 to xls.CommentCountRow(row) do
    begin
      DoSomething(xls.GetCommentRow(row, commentIndex));
    end;
    
  end;

See also