Insert comment

Function Prototype

insertComment(int $row, int $column, string $text): self

insertCommentOpt(int $row, int $column, string $text, array $options): self

showComment(): self

int $row

cell row

int $column

cell column

string $text

comment text

array $options

Optional extended comment settings. All keys are optional:

  • author string — comment author

  • font_name string — font name

  • font_size double — font size

  • color int — background color (0xRRGGBB or a Format::COLOR_* constant)

  • x_offset int — horizontal pixel offset

  • y_offset int — vertical pixel offset

  • x_scale double — horizontal scale factor

  • y_scale double — vertical scale factor

  • width double — box width in pixels

  • height double — box height in pixels

  • visible int — comment display mode. Prefer the class constants below over raw integers:

    • Excel::COMMENT_DISPLAY_DEFAULT — follow the workbook-wide default

    • Excel::COMMENT_DISPLAY_HIDDEN — only shown on hover

    • Excel::COMMENT_DISPLAY_VISIBLE — always pinned open

  • start_row int — anchor row of the box

  • start_col int — anchor column of the box

showComment() toggles the workbook-wide "show all comments" flag. Call it once to make every comment visible by default.

Example

Last updated