Appearance
insertComment(int $row, int $column, string $text): self insertCommentOpt(int $row, int $column, string $text, array $options): self showComment(): self
cell row
cell column
comment text
Optional extended comment settings. All keys are optional:author string — comment authorfont_name string — font namefont_size double — font sizecolor int — background color (0xRRGGBB or a Format::COLOR_* constant)x_offset int — horizontal pixel offsety_offset int — vertical pixel offsetx_scale double — horizontal scale factory_scale double — vertical scale factorwidth double — box width in pixelsheight double — box height in pixelsvisible int — visible by default, 1 = shown / 0 = hiddenstart_row int — anchor row of the boxstart_col int — anchor column of the box
Optional extended comment settings. All keys are optional:
author
font_name
font_size
color
0xRRGGBB
Format::COLOR_*
x_offset
y_offset
x_scale
y_scale
width
height
visible
start_row
start_col
showComment() toggles the workbook-wide "show all comments" flag. Call it once to make every comment visible by default.
showComment()
$config = [ 'path' => './tests' ]; $excel = new \Vtiful\Kernel\Excel($config); $file = $excel->fileName('tutorial.xlsx') ->header(['name', 'score']); $file->insertText(1, 0, 'viest') ->insertText(1, 1, 99) ->insertComment(1, 1, 'Almost a perfect score!') ->insertCommentOpt(1, 0, 'Project owner', [ 'author' => 'admin', 'font_name' => 'Arial', 'font_size' => 10, 'color' => \Vtiful\Kernel\Format::COLOR_YELLOW, 'width' => 200, 'height' => 80, 'visible' => 1, ]) ->showComment() ->output();
Insert comment
Function Prototype
int $row
int $column
string $text
array $options
showComment()toggles the workbook-wide "show all comments" flag. Call it once to make every comment visible by default.Example