Worksheet Interface
The Worksheet interface represents an individual worksheet within a workbook, providing comprehensive functionality for cell manipulation, formatting, and sheet management.
Classes
-
class oo::iWorksheet
Main worksheet interface for cell operations, formatting, and sheet configuration.
Dimensions and Basic Information
-
int min_row() const
Get the minimum row index.
- Returns:
Minimum row index
-
int min_col() const
Get the minimum column index.
- Returns:
Minimum column index
-
int max_row() const
Get the maximum row index.
- Returns:
Maximum row index
-
int max_col() const
Get the maximum column index.
- Returns:
Maximum column index
-
const char *name() const
Get the worksheet name.
- Returns:
Worksheet name
-
bool set_name(const char *newname)
Set the worksheet name.
- Parameters:
newname – New name for the worksheet
- Returns:
true if successful, false if name is invalid or duplicate
-
SheetTypeEnum sheet_type() const
Get the worksheet type.
- Returns:
Type of the worksheet
-
SheetStateEnum get_sheet_state() const
Get the visibility state of the worksheet.
- Returns:
Visibility state
Cell Data Operations
-
CellTypeEnum cell_type(int row, int col) const
Get the data type of a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Cell data type
-
bool contains_formula(int row, int col) const
Check if a cell contains a formula.
- Parameters:
row – Row index
col – Column index
- Returns:
true if cell contains formula
-
bool contains_richtext(int row, int col) const
Check if a cell contains rich text.
- Parameters:
row – Row index
col – Column index
- Returns:
true if cell contains rich text
Data Retrieval Methods
-
double get_num(int row, int col) const
Get numeric value from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Numeric value
-
const char *get_text(int row, int col) const
Get text value from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Text string
-
bool get_boolean(int row, int col) const
Get boolean value from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Boolean value
-
double get_datetime(int row, int col) const
Get datetime value from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
DateTime value as double
-
iRichtext *get_richtext(int row, int col) const
Get rich text object from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Pointer to rich text object
-
const char *get_formula_expr(int row, int col) const
Get formula expression from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Formula expression string
-
ErrorCodeEnum get_error(int row, int col) const
Get error code from a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Error code enumerator
Data Setting Methods
-
bool set_num(int row, int col, double val)
Set numeric value in a cell.
- Parameters:
row – Row index
col – Column index
val – Numeric value to set
- Returns:
true if successful
-
bool set_text(int row, int col, const char *val)
Set text value in a cell.
- Parameters:
row – Row index
col – Column index
val – Text string to set
- Returns:
true if successful
-
bool set_boolean(int row, int col, bool b)
Set boolean value in a cell.
- Parameters:
row – Row index
col – Column index
b – Boolean value to set
- Returns:
true if successful
-
bool set_datetime(int row, int col, double dt)
Set datetime value in a cell.
- Parameters:
row – Row index
col – Column index
dt – DateTime value as double
- Returns:
true if successful
-
bool set_richtext(int row, int col, iRichtext *rt)
Set rich text in a cell.
- Parameters:
row – Row index
col – Column index
rt – Rich text object to set
- Returns:
true if successful
-
bool set_error(int row, int col, ErrorCodeEnum code)
Set error value in a cell.
- Parameters:
row – Row index
col – Column index
code – Error code enumerator to set
- Returns:
true if successful
Formula Operations
-
bool set_formula(int row, int col, const char *expr)
Set formula in a cell.
- Parameters:
row – Row index
col – Column index
expr – Formula expression
- Returns:
true if successful
-
bool set_formula_num(int row, int col, double val)
Set formula that returns numeric value.
- Parameters:
row – Row index
col – Column index
val – Numeric value for formula result
- Returns:
true if successful
-
bool set_formula_string(int row, int col, const char *s)
Set formula that returns string value.
- Parameters:
row – Row index
col – Column index
s – String value for formula result
- Returns:
true if successful
-
bool set_formula_boolean(int row, int col, bool b)
Set formula that returns boolean value.
- Parameters:
row – Row index
col – Column index
b – Boolean value for formula result
- Returns:
true if successful
-
bool set_formula_datetime(int row, int col, double dt)
Set formula that returns datetime value.
- Parameters:
row – Row index
col – Column index
dt – DateTime value for formula result
- Returns:
true if successful
-
bool set_formula_error(int row, int col, ErrorCodeEnum code)
Set formula that returns error value.
- Parameters:
row – Row index
col – Column index
code – Error code for formula result
- Returns:
true if successful
-
void clear_contents(int begin_row, int begin_col, int end_row, int end_col)
Clear cell contents in a range.
- Parameters:
begin_row – Starting row index
begin_col – Starting column index
end_row – Ending row index
end_col – Ending column index
Style and Formatting
-
void set_cell_style(int row, int col, iStyle *style)
Set style for a single cell.
- Parameters:
row – Row index
col – Column index
style – Style object to apply
-
iStyle *cell_style(int row, int col) const
Get style of a specific cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Pointer to cell style
Warning
To save memory, cell_style() returns a pointer to the same instance:
Style* s1 = cell_style(1, 1); //s1 is the format of cell (1,1) Style* s2 = cell_style(2, 2); //s1 is the format of cell (2,2)
That is to say, in the same worksheet, all calls to cell_style() result in the return value of the last call to cell_style(). Please use get_style() if you want independent return values.
Row and Column Dimensions
-
bool is_default_row_height(int start, int end = 0) const
Check if rows have default height.
- Parameters:
start – Starting row index
end – Ending row index (if 0, checks only start row)
- Returns:
true if rows have default height
-
bool get_custom_row_height(int start, int end, double *height, RowHeightUnitEnum unit = ROWHEIGHT_POINTS) const
Get custom row height.
- Parameters:
start – Starting row index
end – Ending row index
height – Pointer to store height value
unit – Unit of measurement
- Returns:
true if custom height exists
-
void set_custom_row_height(int start, int end, double height, RowHeightUnitEnum unit = ROWHEIGHT_POINTS)
Set custom row height.
- Parameters:
start – Starting row index
end – Ending row index
height – Height value to set
unit – Unit of measurement
-
bool is_default_col_width(int start, int end = 0) const
Check if columns have default width.
- Parameters:
start – Starting column index
end – Ending column index (if 0, checks only start column)
- Returns:
true if columns have default width
-
bool get_custom_col_width(int start, int end, double *width, ColWidthUnitEnum unit = COLWIDTH_CHARS) const
Get custom column width.
- Parameters:
start – Starting column index
end – Ending column index
width – Pointer to store width value
unit – Unit of measurement
- Returns:
true if custom width exists
-
void set_custom_col_width(int start, int end, double width, ColWidthUnitEnum unit = COLWIDTH_CHARS)
Set custom column width.
- Parameters:
start – Starting column index
end – Ending column index
width – Width value to set
unit – Unit of measurement
Row and Column Styles
-
iStyle *row_style(int row)
Get row style.
- Parameters:
row – Row index
- Returns:
Pointer to row style
-
void remove_row_style(int row)
Remove row style.
- Parameters:
row – Row index
-
void set_row_style(int start_row, int stop_row, iStyle *style)
Set style for a row range.
- Parameters:
start_row – Starting row index
stop_row – Ending row index
style – Style object to apply
-
iStyle *col_style(int col)
Get column style.
- Parameters:
col – Column index
- Returns:
Pointer to column style
-
void remove_col_style(int col)
Remove column style.
- Parameters:
col – Column index
Visibility Control
Check if a row is hidden.
- Parameters:
row – Row index
- Returns:
true if row is hidden
Set row visibility.
- Parameters:
start_row – Starting row index
stop_row – Ending row index
hidden – true to hide, false to show
Check if a column is hidden.
- Parameters:
col – Column index
- Returns:
true if column is hidden
Set column visibility.
- Parameters:
start_col – Starting column index
stop_col – Ending column index
hidden – true to hide, false to show
Row and Column Operations
-
bool insert_row(int row, int count = 1)
Insert rows.
- Parameters:
row – Row index to insert at
count – Number of rows to insert
- Returns:
true if successful
-
bool delete_row(int begin, int end = 0)
Delete rows.
- Parameters:
begin – Starting row index
end – Ending row index (if 0, deletes only begin row)
- Returns:
true if successful
-
bool insert_col(int col, int count = 1)
Insert columns.
- Parameters:
col – Column index to insert at
count – Number of columns to insert
- Returns:
true if successful
-
bool delete_col(int begin, int end = 0)
Delete columns.
- Parameters:
begin – Starting column index
end – Ending column index (if 0, deletes only begin column)
- Returns:
true if successful
Range Shifting Operations
-
bool shift_range_down(int start_col, int end_col, int start_row, int count = 1)
Shift range downward.
- Parameters:
start_col – Starting column index
end_col – Ending column index
start_row – Starting row index
count – Number of rows to shift
- Returns:
true if successful
-
bool shift_range_up(int start_col, int end_col, int start_row, int count = 1)
Shift range upward.
- Parameters:
start_col – Starting column index
end_col – Ending column index
start_row – Starting row index
count – Number of rows to shift
- Returns:
true if successful
-
bool shift_range_right(int start_row, int end_row, int start_col, int count = 1)
Shift range to the right.
- Parameters:
start_row – Starting row index
end_row – Ending row index
start_col – Starting column index
count – Number of columns to shift
- Returns:
true if successful
-
bool shift_range_left(int start_row, int end_row, int start_col, int count = 1)
Shift range to the left.
- Parameters:
start_row – Starting row index
end_row – Ending row index
start_col – Starting column index
count – Number of columns to shift
- Returns:
true if successful
Images and Background
-
void set_bg_picture(const char *file)
Set background picture.
- Parameters:
file – Path to image file
-
int add_cell_image(const char *file, int start_row, int start_col, int stop_row, int stop_col)
Add an image anchored to specific cells.
- Parameters:
file – Path to image file
start_row – Starting row anchor
start_col – Starting column anchor
stop_row – Ending row anchor
stop_col – Ending column anchor
- Returns:
Image id
-
int add_image_with_two_cells(const char *file, int row1, int col1, int row2, int col2, int offset_x1 = 0, int offset_y1 = 0, int offset_x2 = 0, int offset_y2 = 0)
Add an image to the worksheet, anchoring it between two cells.
- Parameters:
file – Path to the image file.
row1 – Row index of the top-left anchor cell.
col1 – Column index of the top-left anchor cell.
row2 – Row index of the bottom-right anchor cell.
col2 – Column index of the bottom-right anchor cell.
offset_x1 – Horizontal offset from the top-left anchor cell (in pixels).
offset_y1 – Vertical offset from the top-left anchor cell (in pixels).
offset_x2 – Horizontal offset from the bottom-right anchor cell (in pixels).
offset_y2 – Vertical offset from the bottom-right anchor cell (in pixels).
- Returns:
ID of the added image.
-
int add_image_with_one_cell(const char *file, int row, int col, int width = 0, int height = 0, double scale = 1.0, int offset_x = 0, int offset_y = 0)
Add an image to the worksheet, anchored to a single cell. If both width and height are 0, the image size is determined by the scale parameter.
- Parameters:
file – Path to the image file.
row – Row index of the anchor cell.
col – Column index of the anchor cell.
width – Desired width of the image in pixels (0 to use scaling).
height – Desired height of the image in pixels (0 to use scaling).
scale – Scaling factor for the image (used when width and height are 0).
offset_x – Horizontal offset from the anchor cell (in pixels).
offset_y – Vertical offset from the anchor cell (in pixels).
- Returns:
ID of the added image.
-
int add_absolute_image(const char *file, int x, int y, int width = 0, int height = 0, double scale = 1.0)
Add an image to the worksheet, positioned using absolute pixel coordinates. If both width and height are 0, the image size is determined by the scale parameter.
- Parameters:
file – Path to the image file.
x – X-coordinate (in pixels) for the top-left corner of the image.
y – Y-coordinate (in pixels) for the top-left corner of the image.
width – Desired width of the image in pixels (0 to use scaling).
height – Desired height of the image in pixels (0 to use scaling).
scale – Scaling factor for the image (used when width and height are 0).
- Returns:
ID of the added image.
-
int image_num() const
Get the total number of images currently in the worksheet.
- Returns:
Number of images.
-
int get_image_id(int index)
Retrieve the ID of an image based on its insertion order.
- Parameters:
index – Zero‑based index of the image (order of insertion).
- Returns:
Image ID.
-
ImageAnchorEnum image_anchor_type(int image_id)
Get the anchoring type of the specified image.
- Parameters:
image_id – ID of the target image.
- Returns:
An enumeration value of type ImageAnchorEnum.
-
bool get_anchored_cell(int image_id, int *row, int *col)
Retrieve the cell anchor coordinates for an image that uses single‑cell anchoring.
- Parameters:
image_id – ID of the target image.
row – Pointer to store the row index of the anchor cell.
col – Pointer to store the column index of the anchor cell.
- Returns:
true if successful, false otherwise.
-
bool get_absolute_coord(int image_id, int *x, int *y)
Retrieve the absolute pixel coordinates for an image that uses absolute positioning.
- Parameters:
image_id – ID of the target image.
x – Pointer to store the X‑coordinate (in pixels).
y – Pointer to store the Y‑coordinate (in pixels).
- Returns:
true if successful, false otherwise.
-
void delete_image(int image_id)
Remove an image from the worksheet by its ID.
- Parameters:
image_id – ID of the image to delete.
-
void remove_image(int row, int col)
Remove an image by the cell to which it is anchored.
- Parameters:
row – Row index of the anchor cell.
col – Column index of the anchor cell.
-
void remove_absolute_image(int x, int y)
Remove an image by its absolute anchor coordinates.
- Parameters:
x – X‑coordinate (in pixels) of the image’s anchor point.
y – Y‑coordinate (in pixels) of the image’s anchor point.
Cell Merging
-
int merged_num() const
Get number of merged ranges.
- Returns:
Number of merged ranges
-
bool merged_range(int index, int *start_row, int *start_col, int *stop_row, int *stop_col) const
Get a merged range.
- Parameters:
index – Index of merged ranges
start_row – Pointer to store merge start row
start_col – Pointer to store merge start column
stop_row – Pointer to store merge end row
stop_col – Pointer to store merge end column
- Returns:
true if successful
-
bool merge(int start_row, int start_col, int stop_row, int stop_col)
Merge cells in a range.
- Parameters:
start_row – Starting row index
start_col – Starting column index
stop_row – Ending row index
stop_col – Ending column index
- Returns:
true if successful
-
bool unmerge(int row, int col)
Unmerge cells at specified location.
- Parameters:
row – Row index in merged range
col – Column index in merged range
- Returns:
true if successful
Tables (Table Definition)
-
int tabledef_count() const
Get number of tables in the worksheet.
- Returns:
Number of tables
-
const char *get_tabledef_name(int index) const
Get table name by index.
- Parameters:
index – Table index
- Returns:
Table name
-
iTabledef *set_tabledef_name(int index, const char *newName)
Set table name.
- Parameters:
index – Table index
newName – New table name
- Returns:
Pointer to table object
-
iTabledef *get_tabledef(int index) const
Get table by index.
- Parameters:
index – Table index
- Returns:
Pointer to table object
-
iTabledef *get_tabledef_by_name(const char *name) const
Get table by name.
- Parameters:
name – Table name
- Returns:
Pointer to table object
-
iTabledef *add_tabledef(const char *name, int begin_row, int begin_col, int end_row, int end_col)
Add a new table to the worksheet.
- Parameters:
name – Table name
begin_row – Starting row index
begin_col – Starting column index
end_row – Ending row index
end_col – Ending column index
- Returns:
Pointer to new table object
-
bool delete_tabledef(const char *name)
Delete a table by name.
- Parameters:
name – Table name to delete
- Returns:
true if successful
Grouping and Outlining
-
void group_rows(int begin_row, int end_row, bool collapsed = false)
Group rows for outlining.
- Parameters:
begin_row – Starting row index
end_row – Ending row index
collapsed – true to initially collapse the group
-
void ungroup_rows(int begin_row, int end_row)
Ungroup rows.
- Parameters:
begin_row – Starting row index
end_row – Ending row index
-
void group_cols(int begin_col, int end_col, bool collapsed = true)
Group columns for outlining.
- Parameters:
begin_col – Starting column index
end_col – Ending column index
collapsed – true to initially collapse the group
-
void ungroup_cols(int begin_col, int end_col)
Ungroup columns.
- Parameters:
begin_col – Starting column index
end_col – Ending column index
-
int row_outline_level(int row, bool *collapsed = nullptr) const
Get row outline level.
- Parameters:
row – Row index
collapsed – Pointer to store collapse state
- Returns:
Outline level
-
int col_outline_level(int col, bool *collapsed = nullptr) const
Get column outline level.
- Parameters:
col – Column index
collapsed – Pointer to store collapse state
- Returns:
Outline level
-
int max_row_outline_level() const
Get maximum row outline level.
- Returns:
Maximum outline level
-
int max_col_outline_level() const
Get maximum column outline level.
- Returns:
Maximum outline level
-
void delete_row_outline()
Remove all row outlining.
-
void delete_col_outline()
Remove all column outlining.
-
bool group_summary_below() const
Check if group summary rows are below detail.
- Returns:
true if summary below detail
-
void set_group_summary_below(bool below)
Set group summary row position.
- Parameters:
below – true for summary below detail, false for above
-
bool group_summary_right() const
Check if group summary columns are to the right of detail.
- Returns:
true if summary right of detail
-
void set_group_summary_right(bool right)
Set group summary column position.
- Parameters:
right – true for summary right of detail, false for left
Hyperlinks
-
bool add_hyperlink(const char *hyperlink, int start_row, int start_col, int end_row, int end_col)
Add a hyperlink to a cell range.
- Parameters:
hyperlink – URL or link address
start_row – Starting row index
start_col – Starting column index
end_row – Ending row index
end_col – Ending column index
- Returns:
true if successful
-
int hyperlink_num() const
Get number of hyperlinks.
- Returns:
Number of hyperlinks
-
int hyperlink_index(int row, int col) const
Get hyperlink index for a cell.
- Parameters:
row – Row index
col – Column index
- Returns:
Hyperlink index, or -1 if not found
-
const char *hyperlink(int index, int *start_row, int *start_col, int *end_row, int *end_col)
Get hyperlink information.
- Parameters:
index – Hyperlink index
start_row – Pointer to store starting row
start_col – Pointer to store starting column
end_row – Pointer to store ending row
end_col – Pointer to store ending column
- Returns:
Hyperlink address
-
bool delete_hyperlink(int index)
Delete a hyperlink.
- Parameters:
index – Hyperlink index to delete
- Returns:
true if successful
Sheet Protection
-
bool is_protected() const
Check if worksheet is protected.
- Returns:
true if protected
-
bool protect(SheetProtectEnum item = PROTECT_DEFAULT, const char *password = nullptr)
Protect the worksheet.
- Parameters:
item – Protection options
password – Optional password
- Returns:
true if successful
-
void unprotect()
Unprotect the worksheet.
-
bool protect_range(int start_row, int start_col, int end_row, int end_col)
Protect specific cell range.
- Parameters:
start_row – Starting row index
start_col – Starting column index
end_row – Ending row index
end_col – Ending column index
- Returns:
true if successful
-
bool set_editable_range(int start_row, int start_col, int end_row, int end_col)
Allow editing in specific range on protected sheet.
- Parameters:
start_row – Starting row index
start_col – Starting column index
end_row – Ending row index
end_col – Ending column index
- Returns:
true if successful
-
int editable_range_count() const
Get number of editable ranges.
- Returns:
Number of edit ranges
-
const char *get_editable_range(int index, int *start_row = nullptr, int *start_col = nullptr, int *stop_row = nullptr, int *stop_col = nullptr) const
Get editable range information.
- Parameters:
index – Editable range index
start_row – Pointer to store starting row
start_col – Pointer to store starting column
stop_row – Pointer to store ending row
stop_col – Pointer to store ending column
- Returns:
Range name
-
bool delete_editable_range(int index)
Delete an editable range.
- Parameters:
index – Editable range index to delete
- Returns:
true if successful
View Settings
-
int zoom() const
Get worksheet zoom level.
- Returns:
Zoom percentage
-
void set_zoom(int zoom)
Set worksheet zoom level.
- Parameters:
zoom – Zoom percentage
-
bool right_to_left() const
Check if right-to-left display is enabled.
- Returns:
true if right-to-left
-
void set_right_to_left(bool right_to_left = true)
Set right-to-left display mode.
- Parameters:
right_to_left – true for right-to-left, false for left-to-right
-
void topleft_cell(int *row, int *col) const
Get top-left visible cell.
- Parameters:
row – Pointer to store row index
col – Pointer to store column index
-
void set_topleft_cell(int row, int col)
Set top-left visible cell.
- Parameters:
row – Row index
col – Column index
-
void active_cell(int *row, int *col) const
Get active cell position.
- Parameters:
row – Pointer to store row index
col – Pointer to store column index
-
void set_active_cell(int row, int col)
Set active cell.
- Parameters:
row – Row index
col – Column index
-
void split_cell(int *row, int *col) const
Get split position.
- Parameters:
row – Pointer to store split row
col – Pointer to store split column
-
void set_split_cell(int row, int col)
Set split position.
- Parameters:
row – Split row index
col – Split column index
-
bool display_gridlines() const
Check if gridlines are displayed.
- Returns:
true if gridlines visible
-
void set_display_gridlines(bool show = true)
Set gridline visibility.
- Parameters:
show – true to show gridlines, false to hide
Page Breaks
-
int row_break_count() const
Get number of row page breaks.
- Returns:
Number of row breaks
-
int row_break(int index) const
Get row break position.
- Parameters:
index – Break index
- Returns:
Row index of break
-
bool set_row_break(int row, bool pageBreak = true)
Set row page break.
- Parameters:
row – Row index for break
pageBreak – true for page break, false for manual break
- Returns:
true if successful
-
int col_break_count() const
Get number of column page breaks.
- Returns:
Number of column breaks
-
int col_break(int index) const
Get column break position.
- Parameters:
index – Break index
- Returns:
Column index of break
-
bool set_col_break(int col, bool pageBreak = true)
Set column page break.
- Parameters:
col – Column index for break
pageBreak – true for page break, false for manual break
- Returns:
true if successful
Print Settings
-
bool print_gridlines() const
Check if gridlines are printed.
- Returns:
true if gridlines will print
-
void set_print_gridlines(bool print = true)
Set gridline printing.
- Parameters:
print – true to print gridlines
-
bool print_headings() const
Check if headings are printed.
- Returns:
true if headings will print
-
void set_print_headings(bool print = false)
Set heading printing.
- Parameters:
print – true to print headings
-
bool h_centered_printing() const
Check if horizontal centering is enabled for printing.
- Returns:
true if horizontally centered
-
void set_h_centered_printing(bool centered = true)
Set horizontal centering for printing.
- Parameters:
centered – true to center horizontally
-
bool v_centered_printing() const
Check if vertical centering is enabled for printing.
- Returns:
true if vertically centered
-
void set_v_centered_printing(bool centered = true)
Set vertical centering for printing.
- Parameters:
centered – true to center vertically
Page Margins
-
double left_margin() const
Get left margin.
- Returns:
Left margin value
-
void set_left_margin(double value)
Set left margin.
- Parameters:
value – Margin value
-
double right_margin() const
Get right margin.
- Returns:
Right margin value
-
void set_right_margin(double value)
Set right margin.
- Parameters:
value – Margin value
-
double top_margin() const
Get top margin.
- Returns:
Top margin value
-
void set_top_margin(double value)
Set top margin.
- Parameters:
value – Margin value
-
double bottom_margin() const
Get bottom margin.
- Returns:
Bottom margin value
-
void set_bottom_margin(double value)
Set bottom margin.
- Parameters:
value – Margin value
-
double header_margin() const
Get header margin.
- Returns:
Header margin value
-
void set_header_margin(double value)
Set header margin.
- Parameters:
value – Margin value
Get footer margin.
- Returns:
Footer margin value
Set footer margin.
- Parameters:
value – Margin value
Page Setup
-
int paper() const
Get paper size code.
- Returns:
Paper size code
-
bool set_paper(int paper_code)
Set paper size.
- Parameters:
paper_code – Paper size code
- Returns:
true if successful
-
int print_scale() const
Get print scale.
- Returns:
Print scale percentage
-
void set_print_scale(int zoom)
Set print scale.
- Parameters:
zoom – Scale percentage
-
PageOrientEnum page_orientation() const
Get page orientation.
- Returns:
Page orientation
-
void set_page_orientation(PageOrientEnum orientation)
Set page orientation.
- Parameters:
orientation – Orientation to set
-
PrintErrorEnum print_errors() const
Get error printing method.
- Returns:
Error printing method
-
void set_print_errors(PrintErrorEnum way)
Set how errors are printed.
- Parameters:
way – Error printing method
-
int fit_page_height() const
Get fit to page height setting.
- Returns:
Number of pages high to fit
-
void set_fit_page_height(int num)
Set fit to page height.
- Parameters:
num – Number of pages high to fit (0 to disable)
-
int fit_page_width() const
Get fit to page width setting.
- Returns:
Number of pages wide to fit
-
void set_fit_page_width(int num)
Set fit to page width.
- Parameters:
num – Number of pages wide to fit (0 to disable)
-
int min_row() const
Usage Example
#include "oosxl.hxx"
// Get worksheet from workbook
oo::iWorksheet* sheet = workbook->get_sheet(0);
// Set cell values
sheet->set_text(0, 0, "Name");
sheet->set_text(0, 1, "Age");
sheet->set_num(1, 0, 25.5);
sheet->set_boolean(1, 1, true);
// Apply styles
oo::iStyle* headerStyle = workbook->make_normal_style();
headerStyle->set_bold(true);
sheet->set_range_style(0, 0, 0, 1, headerStyle);
// Merge cells
sheet->merge(0, 0, 0, 2);
// Add hyperlink
sheet->add_hyperlink("https://example.com", 2, 0, 2, 0);