UmyaSpreadsheet.CommentFunctions (umya_spreadsheet_ex v0.7.0)
View SourceFunctions for working with cell comments in spreadsheets.
Summary
Functions
Adds a comment to a cell.
Gets the comment text and author from a cell.
Gets the number of comments in a sheet.
Checks if a sheet has any comments.
Removes a comment from a cell.
Updates an existing comment in a cell.
Functions
@spec add_comment( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t(), String.t() ) :: :ok | {:error, atom()}
Adds a comment to a cell.
Parameters
spreadsheet
- The spreadsheet referencesheet_name
- Name of the worksheetcell_address
- Cell address in A1 notation (e.g., "A1", "B2")text
- Text content of the commentauthor
- Name of the comment author
Examples
iex> UmyaSpreadsheet.add_comment(spreadsheet, "Sheet1", "A1", "This is a comment", "John Doe")
:ok
@spec get_comment(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, String.t(), String.t()} | {:error, atom()}
Gets the comment text and author from a cell.
Parameters
spreadsheet
- The spreadsheet referencesheet_name
- Name of the worksheetcell_address
- Cell address in A1 notation (e.g., "A1", "B2")
Examples
iex> UmyaSpreadsheet.get_comment(spreadsheet, "Sheet1", "A1")
{:ok, "This is a comment", "John Doe"}
@spec get_comments_count(UmyaSpreadsheet.Spreadsheet.t(), String.t()) :: integer() | {:error, atom()}
Gets the number of comments in a sheet.
Parameters
spreadsheet
- The spreadsheet referencesheet_name
- Name of the worksheet
Examples
iex> UmyaSpreadsheet.get_comments_count(spreadsheet, "Sheet1")
3
@spec has_comments(UmyaSpreadsheet.Spreadsheet.t(), String.t()) :: boolean() | {:error, atom()}
Checks if a sheet has any comments.
Parameters
spreadsheet
- The spreadsheet referencesheet_name
- Name of the worksheet
Examples
iex> UmyaSpreadsheet.has_comments(spreadsheet, "Sheet1")
true
@spec remove_comment(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: :ok | {:error, atom()}
Removes a comment from a cell.
Parameters
spreadsheet
- The spreadsheet referencesheet_name
- Name of the worksheetcell_address
- Cell address in A1 notation (e.g., "A1", "B2")
Examples
iex> UmyaSpreadsheet.remove_comment(spreadsheet, "Sheet1", "A1")
:ok
@spec update_comment( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t(), String.t() | nil ) :: :ok | {:error, atom()}
Updates an existing comment in a cell.
Parameters
spreadsheet
- The spreadsheet referencesheet_name
- Name of the worksheetcell_address
- Cell address in A1 notation (e.g., "A1", "B2")text
- New text content for the commentauthor
- Optional new author name (if nil, keeps the existing author)
Examples
iex> UmyaSpreadsheet.update_comment(spreadsheet, "Sheet1", "A1", "Updated comment")
:ok
iex> UmyaSpreadsheet.update_comment(spreadsheet, "Sheet1", "A1", "Updated comment", "Jane Smith")
:ok