UmyaSpreadsheet.RowColumnFunctions (umya_spreadsheet_ex v0.7.0)
View SourceFunctions for manipulating rows and columns in a spreadsheet.
Summary
Functions
Copies styling from one column to another.
Copies styling from one row to another.
Gets whether a column width is automatically adjusted.
Gets whether a column is hidden.
Gets the width of a column.
Gets the height of a row.
Gets whether a row is hidden.
Sets whether a column width should be automatically adjusted.
Sets the width of a column.
Sets the height of a row.
Sets styles for an entire row.
Functions
Copies styling from one column to another.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetsource_column
- The source column index (1-based)target_column
- The target column index (1-based)start_row
- Optional starting row index (1-based)end_row
- Optional ending row index (1-based)
Returns
:ok
on success{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
# Copy styling for all cells in column A to column B
:ok = UmyaSpreadsheet.RowColumnFunctions.copy_column_styling(spreadsheet, "Sheet1", 1, 2, nil, nil)
# Copy styling only for rows 1 through 10
:ok = UmyaSpreadsheet.RowColumnFunctions.copy_column_styling(spreadsheet, "Sheet1", 1, 2, 1, 10)
Copies styling from one row to another.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetsource_row
- The source row number (1-based)target_row
- The target row number (1-based)start_column
- Optional starting column index (1-based)end_column
- Optional ending column index (1-based)
Returns
:ok
on success{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
# Copy styling for all cells in row 1 to row 2
:ok = UmyaSpreadsheet.RowColumnFunctions.copy_row_styling(spreadsheet, "Sheet1", 1, 2, nil, nil)
# Copy styling only for columns A through C (columns 1-3)
:ok = UmyaSpreadsheet.RowColumnFunctions.copy_row_styling(spreadsheet, "Sheet1", 1, 2, 1, 3)
Gets whether a column width is automatically adjusted.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetcolumn
- The column letter (e.g., "A", "B")
Returns
{:ok, auto_width}
on success where auto_width is a boolean{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, auto_width} = UmyaSpreadsheet.RowColumnFunctions.get_column_auto_width(spreadsheet, "Sheet1", "A")
Gets the width of a column.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetcolumn
- The column letter (e.g., "A", "B")
Returns
{:ok, width}
on success where width is a float{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, width} = UmyaSpreadsheet.RowColumnFunctions.get_column_width(spreadsheet, "Sheet1", "A")
Gets the height of a row.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetrow_number
- The row number (1-based)
Returns
{:ok, height}
on success where height is a float{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, height} = UmyaSpreadsheet.RowColumnFunctions.get_row_height(spreadsheet, "Sheet1", 1)
Sets whether a column width should be automatically adjusted.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetcolumn
- The column letter (e.g., "A", "B")auto_width
- Boolean indicating whether auto-width should be enabled
Returns
:ok
on success{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.RowColumnFunctions.set_column_auto_width(spreadsheet, "Sheet1", "A", true)
Sets the width of a column.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetcolumn
- The column letter (e.g., "A", "B")width
- The width value
Returns
:ok
on success{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.RowColumnFunctions.set_column_width(spreadsheet, "Sheet1", "A", 15.5)
Sets the height of a row.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetrow_number
- The row number (1-based)height
- The height value (in points)
Returns
:ok
on success{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.RowColumnFunctions.set_row_height(spreadsheet, "Sheet1", 1, 20.5)
Sets styles for an entire row.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheetrow_number
- The row number (1-based)bg_color
- The background color code (e.g., "#FF0000" for red)font_color
- The font color code (e.g., "#FFFFFF" for white)
Returns
:ok
on success{:error, reason}
on failure
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
# Set row background to red and text to white
:ok = UmyaSpreadsheet.RowColumnFunctions.set_row_style(spreadsheet, "Sheet1", 1, "#FF0000", "#FFFFFF")