.. _worksheet-api:

Worksheet Interface
===================

The Worksheet interface represents an individual worksheet within a workbook,
providing comprehensive functionality for cell manipulation,
formatting, and sheet management.

Classes
-------

.. cpp:class:: oo::iWorksheet

   Main worksheet interface for cell operations, formatting, and sheet configuration.

   Dimensions and Basic Information
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: int min_row() const

      Get the minimum row index.

      :returns: Minimum row index

   .. cpp:function:: int min_col() const

      Get the minimum column index.

      :returns: Minimum column index

   .. cpp:function:: int max_row() const

      Get the maximum row index.

      :returns: Maximum row index

   .. cpp:function:: int max_col() const

      Get the maximum column index.

      :returns: Maximum column index

   .. cpp:function:: const char* name() const

      Get the worksheet name.

      :returns: Worksheet name

   .. cpp:function:: bool set_name(const char* newname)

      Set the worksheet name.

      :param newname: New name for the worksheet
      :returns: true if successful, false if name is invalid or duplicate

   .. cpp:function:: SheetTypeEnum sheet_type() const

      Get the worksheet type.

      :returns: Type of the worksheet

   .. cpp:function:: SheetStateEnum get_sheet_state() const

      Get the visibility state of the worksheet.

      :returns: Visibility state

   Cell Data Operations
   ~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: CellTypeEnum cell_type(int row, int col) const

      Get the data type of a cell.

      :param row: Row index
      :param col: Column index
      :returns: Cell data type

   .. cpp:function:: bool contains_formula(int row, int col) const

      Check if a cell contains a formula.

      :param row: Row index
      :param col: Column index
      :returns: true if cell contains formula

   .. cpp:function:: bool contains_richtext(int row, int col) const

      Check if a cell contains rich text.

      :param row: Row index
      :param col: Column index
      :returns: true if cell contains rich text

   Data Retrieval Methods
   ~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: double get_num(int row, int col) const

      Get numeric value from a cell.

      :param row: Row index
      :param col: Column index
      :returns: Numeric value

   .. cpp:function:: const char* get_text(int row, int col) const

      Get text value from a cell.

      :param row: Row index
      :param col: Column index
      :returns: Text string

   .. cpp:function:: bool get_boolean(int row, int col) const

      Get boolean value from a cell.

      :param row: Row index
      :param col: Column index
      :returns: Boolean value

   .. cpp:function:: double get_datetime(int row, int col) const

      Get datetime value from a cell.

      :param row: Row index
      :param col: Column index
      :returns: DateTime value as double

   .. cpp:function:: iRichtext* get_richtext(int row, int col) const

      Get rich text object from a cell.

      :param row: Row index
      :param col: Column index
      :returns: Pointer to rich text object

   .. cpp:function:: const char* get_formula_expr(int row, int col) const

      Get formula expression from a cell.

      :param row: Row index
      :param col: Column index
      :returns: Formula expression string

   .. cpp:function:: ErrorCodeEnum get_error(int row, int col) const

      Get error code from a cell.

      :param row: Row index
      :param col: Column index
      :returns: Error code enumerator

   Data Setting Methods
   ~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: bool set_num(int row, int col, double val)

      Set numeric value in a cell.

      :param row: Row index
      :param col: Column index
      :param val: Numeric value to set
      :returns: true if successful

   .. cpp:function:: bool set_text(int row, int col, const char* val)

      Set text value in a cell.

      :param row: Row index
      :param col: Column index
      :param val: Text string to set
      :returns: true if successful

   .. cpp:function:: bool set_boolean(int row, int col, bool b)

      Set boolean value in a cell.

      :param row: Row index
      :param col: Column index
      :param b: Boolean value to set
      :returns: true if successful

   .. cpp:function:: bool set_datetime(int row, int col, double dt)

      Set datetime value in a cell.

      :param row: Row index
      :param col: Column index
      :param dt: DateTime value as double
      :returns: true if successful

   .. cpp:function:: bool set_richtext(int row, int col, iRichtext* rt)

      Set rich text in a cell.

      :param row: Row index
      :param col: Column index
      :param rt: Rich text object to set
      :returns: true if successful

   .. cpp:function:: bool set_error(int row, int col, ErrorCodeEnum code)

      Set error value in a cell.

      :param row: Row index
      :param col: Column index
      :param code: Error code enumerator to set
      :returns: true if successful

   Formula Operations
   ~~~~~~~~~~~~~~~~~~

   .. cpp:function:: bool set_formula(int row, int col, const char* expr)

      Set formula in a cell.

      :param row: Row index
      :param col: Column index
      :param expr: Formula expression
      :returns: true if successful

   .. cpp:function:: bool set_formula_num(int row, int col, double val)

      Set formula that returns numeric value.

      :param row: Row index
      :param col: Column index
      :param val: Numeric value for formula result
      :returns: true if successful

   .. cpp:function:: bool set_formula_string(int row, int col, const char* s)

      Set formula that returns string value.

      :param row: Row index
      :param col: Column index
      :param s: String value for formula result
      :returns: true if successful

   .. cpp:function:: bool set_formula_boolean(int row, int col, bool b)

      Set formula that returns boolean value.

      :param row: Row index
      :param col: Column index
      :param b: Boolean value for formula result
      :returns: true if successful

   .. cpp:function:: bool set_formula_datetime(int row, int col, double dt)

      Set formula that returns datetime value.

      :param row: Row index
      :param col: Column index
      :param dt: DateTime value for formula result
      :returns: true if successful

   .. cpp:function:: bool set_formula_error(int row, int col, ErrorCodeEnum code)

      Set formula that returns error value.

      :param row: Row index
      :param col: Column index
      :param code: Error code for formula result
      :returns: true if successful

   .. cpp:function:: void clear_contents(int begin_row, int begin_col, int end_row, int end_col)

      Clear cell contents in a range.

      :param begin_row: Starting row index
      :param begin_col: Starting column index
      :param end_row: Ending row index
      :param end_col: Ending column index

   Style and Formatting
   ~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: void set_cell_style(int row, int col, iStyle* style)

      Set style for a single cell.

      :param row: Row index
      :param col: Column index
      :param style: Style object to apply

   .. cpp:function:: iStyle* cell_style(int row, int col) const

      Get style of a specific cell.

      :param row: Row index
      :param col: Column index
      :returns: Pointer to cell style

      .. warning::

         To save memory, cell_style() returns a pointer to the same instance:

         .. code-block:: C++

            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.

   .. cpp:function:: iStyle* get_style(int row, int col) const

      Get style of a specific cell.

      :param row: Row index
      :param col: Column index
      :returns: Pointer to effective style

      .. note::

         When the returned pointer is no longer in use, it is recommended to call release() to release its memory.

   .. cpp:function:: void set_range_style(int start_row, int start_col, int stop_row, int stop_col, iStyle* style)

      Set style for a cell range.

      :param start_row: Starting row index
      :param start_col: Starting column index
      :param stop_row: Ending row index
      :param stop_col: Ending column index
      :param style: Style object to apply

   Row and Column Dimensions
   ~~~~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: bool is_default_row_height(int start, int end = 0) const

      Check if rows have default height.

      :param start: Starting row index
      :param end: Ending row index (if 0, checks only start row)
      :returns: true if rows have default height

   .. cpp:function:: bool get_custom_row_height(int start, int end, double* height, RowHeightUnitEnum unit = ROWHEIGHT_POINTS) const

      Get custom row height.

      :param start: Starting row index
      :param end: Ending row index
      :param height: Pointer to store height value
      :param unit: Unit of measurement
      :returns: true if custom height exists

   .. cpp:function:: void set_custom_row_height(int start, int end, double height, RowHeightUnitEnum unit = ROWHEIGHT_POINTS)

      Set custom row height.

      :param start: Starting row index
      :param end: Ending row index
      :param height: Height value to set
      :param unit: Unit of measurement

   .. cpp:function:: bool is_default_col_width(int start, int end = 0) const

      Check if columns have default width.

      :param start: Starting column index
      :param end: Ending column index (if 0, checks only start column)
      :returns: true if columns have default width

   .. cpp:function:: bool get_custom_col_width(int start, int end, double* width, ColWidthUnitEnum unit = COLWIDTH_CHARS) const

      Get custom column width.

      :param start: Starting column index
      :param end: Ending column index
      :param width: Pointer to store width value
      :param unit: Unit of measurement
      :returns: true if custom width exists

   .. cpp:function:: void set_custom_col_width(int start, int end, double width, ColWidthUnitEnum unit = COLWIDTH_CHARS)

      Set custom column width.

      :param start: Starting column index
      :param end: Ending column index
      :param width: Width value to set
      :param unit: Unit of measurement

   Row and Column Styles
   ~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: iStyle* row_style(int row)

      Get row style.

      :param row: Row index
      :returns: Pointer to row style

   .. cpp:function:: void remove_row_style(int row)

      Remove row style.

      :param row: Row index

   .. cpp:function:: void set_row_style(int start_row, int stop_row, iStyle* style)

      Set style for a row range.

      :param start_row: Starting row index
      :param stop_row: Ending row index
      :param style: Style object to apply

   .. cpp:function:: iStyle* col_style(int col)

      Get column style.

      :param col: Column index
      :returns: Pointer to column style

   .. cpp:function:: void remove_col_style(int col)

      Remove column style.

      :param col: Column index

   .. cpp:function:: void set_col_style(int start_col, int stop_col, iStyle* style)

      Set style for a column range.

      :param start_col: Starting column index
      :param stop_col: Ending column index
      :param style: Style object to apply

   Visibility Control
   ~~~~~~~~~~~~~~~~~~

   .. cpp:function:: bool row_hidden(int row) const

      Check if a row is hidden.

      :param row: Row index
      :returns: true if row is hidden

   .. cpp:function:: void set_row_hidden(int start_row, int stop_row, bool hidden = true)

      Set row visibility.

      :param start_row: Starting row index
      :param stop_row: Ending row index
      :param hidden: true to hide, false to show

   .. cpp:function:: bool col_hidden(int col) const

      Check if a column is hidden.

      :param col: Column index
      :returns: true if column is hidden

   .. cpp:function:: void set_col_hidden(int start_col, int stop_col, bool hidden = true)

      Set column visibility.

      :param start_col: Starting column index
      :param stop_col: Ending column index
      :param hidden: true to hide, false to show

   Row and Column Operations
   ~~~~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: bool insert_row(int row, int count = 1)

      Insert rows.

      :param row: Row index to insert at
      :param count: Number of rows to insert
      :returns: true if successful

   .. cpp:function:: bool delete_row(int begin, int end = 0)

      Delete rows.

      :param begin: Starting row index
      :param end: Ending row index (if 0, deletes only begin row)
      :returns: true if successful

   .. cpp:function:: bool insert_col(int col, int count = 1)

      Insert columns.

      :param col: Column index to insert at
      :param count: Number of columns to insert
      :returns: true if successful

   .. cpp:function:: bool delete_col(int begin, int end = 0)

      Delete columns.

      :param begin: Starting column index
      :param end: Ending column index (if 0, deletes only begin column)
      :returns: true if successful

   Range Shifting Operations
   ~~~~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: bool shift_range_down(int start_col, int end_col, int start_row, int count = 1)

      Shift range downward.

      :param start_col: Starting column index
      :param end_col: Ending column index
      :param start_row: Starting row index
      :param count: Number of rows to shift
      :returns: true if successful

   .. cpp:function:: bool shift_range_up(int start_col, int end_col, int start_row, int count = 1)

      Shift range upward.

      :param start_col: Starting column index
      :param end_col: Ending column index
      :param start_row: Starting row index
      :param count: Number of rows to shift
      :returns: true if successful

   .. cpp:function:: bool shift_range_right(int start_row, int end_row, int start_col, int count = 1)

      Shift range to the right.

      :param start_row: Starting row index
      :param end_row: Ending row index
      :param start_col: Starting column index
      :param count: Number of columns to shift
      :returns: true if successful

   .. cpp:function:: bool shift_range_left(int start_row, int end_row, int start_col, int count = 1)

      Shift range to the left.

      :param start_row: Starting row index
      :param end_row: Ending row index
      :param start_col: Starting column index
      :param count: Number of columns to shift
      :returns: true if successful

   Images and Background
   ~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: void set_bg_picture(const char* file)

      Set background picture.

      :param file: Path to image file

   .. cpp:function:: 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.

      :param file: Path to image file
      :param start_row: Starting row anchor
      :param start_col: Starting column anchor
      :param stop_row: Ending row anchor
      :param stop_col: Ending column anchor
      :returns: Image id
   
   .. cpp:function:: 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.

      :param file: Path to the image file.
      :param row1: Row index of the top-left anchor cell.
      :param col1: Column index of the top-left anchor cell.
      :param row2: Row index of the bottom-right anchor cell.
      :param col2: Column index of the bottom-right anchor cell.
      :param offset_x1: Horizontal offset from the top-left anchor cell (in pixels).
      :param offset_y1: Vertical offset from the top-left anchor cell (in pixels).
      :param offset_x2: Horizontal offset from the bottom-right anchor cell (in pixels).
      :param offset_y2: Vertical offset from the bottom-right anchor cell (in pixels).
      :returns: ID of the added image.

   .. cpp:function:: 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.

      :param file: Path to the image file.
      :param row: Row index of the anchor cell.
      :param col: Column index of the anchor cell.
      :param width: Desired width of the image in pixels (0 to use scaling).
      :param height: Desired height of the image in pixels (0 to use scaling).
      :param scale: Scaling factor for the image (used when width and height are 0).
      :param offset_x: Horizontal offset from the anchor cell (in pixels).
      :param offset_y: Vertical offset from the anchor cell (in pixels).
      :returns: ID of the added image.

   .. cpp:function:: 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.

      :param file: Path to the image file.
      :param x: X-coordinate (in pixels) for the top-left corner of the image.
      :param y: Y-coordinate (in pixels) for the top-left corner of the image.
      :param width: Desired width of the image in pixels (0 to use scaling).
      :param height: Desired height of the image in pixels (0 to use scaling).
      :param scale: Scaling factor for the image (used when width and height are 0).
      :returns: ID of the added image.

   .. cpp:function:: int image_num() const

      Get the total number of images currently in the worksheet.

      :returns: Number of images.

   .. cpp:function:: int get_image_id(int index)

      Retrieve the ID of an image based on its insertion order.

      :param index: Zero‑based index of the image (order of insertion).
      :returns: Image ID.

   .. cpp:function:: ImageAnchorEnum image_anchor_type(int image_id)

      Get the anchoring type of the specified image.

      :param image_id: ID of the target image.
      :returns: An enumeration value of type ImageAnchorEnum.

   .. cpp:function:: bool get_anchored_cell(int image_id, int* row, int* col)

      Retrieve the cell anchor coordinates for an image that uses single‑cell anchoring.

      :param image_id: ID of the target image.
      :param row: Pointer to store the row index of the anchor cell.
      :param col: Pointer to store the column index of the anchor cell.
      :returns: true if successful, false otherwise.

   .. cpp:function:: bool get_absolute_coord(int image_id, int* x, int* y)

      Retrieve the absolute pixel coordinates for an image that uses absolute positioning.

      :param image_id: ID of the target image.
      :param x: Pointer to store the X‑coordinate (in pixels).
      :param y: Pointer to store the Y‑coordinate (in pixels).
      :returns: true if successful, false otherwise.

   .. cpp:function:: void delete_image(int image_id)

      Remove an image from the worksheet by its ID.

      :param image_id: ID of the image to delete.

   .. cpp:function:: void remove_image(int row, int col)

      Remove an image by the cell to which it is anchored.

      :param row: Row index of the anchor cell.
      :param col: Column index of the anchor cell.

   .. cpp:function:: void remove_absolute_image(int x, int y)

      Remove an image by its absolute anchor coordinates.

      :param x: X‑coordinate (in pixels) of the image's anchor point.
      :param y: Y‑coordinate (in pixels) of the image's anchor point.

   Cell Navigation
   ~~~~~~~~~~~~~~~

   .. cpp:function:: bool first_data_cell(int* row, int* col) const

      Find the first cell with data.

      :param row: Pointer to store row index
      :param col: Pointer to store column index
      :returns: true if data cell found

   .. cpp:function:: bool last_data_cell(int* row, int* col) const

      Find the last cell with data.

      :param row: Pointer to store row index
      :param col: Pointer to store column index
      :returns: true if data cell found

   Cell Merging
   ~~~~~~~~~~~~

   .. cpp:function:: int merged_num() const

      Get number of merged ranges.

      :returns: Number of merged ranges

   .. cpp:function:: bool merged_range(int index, int* start_row, int* start_col, int* stop_row, int* stop_col) const

      Get a merged range.

      :param index: Index of merged ranges
      :param start_row: Pointer to store merge start row
      :param start_col: Pointer to store merge start column
      :param stop_row: Pointer to store merge end row
      :param stop_col: Pointer to store merge end column
      :returns: true if successful

   .. cpp:function:: bool merge(int start_row, int start_col, int stop_row, int stop_col)

      Merge cells in a range.

      :param start_row: Starting row index
      :param start_col: Starting column index
      :param stop_row: Ending row index
      :param stop_col: Ending column index
      :returns: true if successful

   .. cpp:function:: bool unmerge(int row, int col)

      Unmerge cells at specified location.

      :param row: Row index in merged range
      :param col: Column index in merged range
      :returns: true if successful

   Tables (Table Definition)
   ~~~~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: int tabledef_count() const

      Get number of tables in the worksheet.

      :returns: Number of tables

   .. cpp:function:: const char* get_tabledef_name(int index) const

      Get table name by index.

      :param index: Table index
      :returns: Table name

   .. cpp:function:: iTabledef* set_tabledef_name(int index, const char* newName)

      Set table name.

      :param index: Table index
      :param newName: New table name
      :returns: Pointer to table object

   .. cpp:function:: iTabledef* get_tabledef(int index) const

      Get table by index.

      :param index: Table index
      :returns: Pointer to table object

   .. cpp:function:: iTabledef* get_tabledef_by_name(const char* name) const

      Get table by name.

      :param name: Table name
      :returns: Pointer to table object

   .. cpp:function:: 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.

      :param name: Table name
      :param begin_row: Starting row index
      :param begin_col: Starting column index
      :param end_row: Ending row index
      :param end_col: Ending column index
      :returns: Pointer to new table object

   .. cpp:function:: bool delete_tabledef(const char* name)

      Delete a table by name.

      :param name: Table name to delete
      :returns: true if successful

   Grouping and Outlining
   ~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: void group_rows(int begin_row, int end_row, bool collapsed = false)

      Group rows for outlining.

      :param begin_row: Starting row index
      :param end_row: Ending row index
      :param collapsed: true to initially collapse the group

   .. cpp:function:: void ungroup_rows(int begin_row, int end_row)

      Ungroup rows.

      :param begin_row: Starting row index
      :param end_row: Ending row index

   .. cpp:function:: void group_cols(int begin_col, int end_col, bool collapsed = true)

      Group columns for outlining.

      :param begin_col: Starting column index
      :param end_col: Ending column index
      :param collapsed: true to initially collapse the group

   .. cpp:function:: void ungroup_cols(int begin_col, int end_col)

      Ungroup columns.

      :param begin_col: Starting column index
      :param end_col: Ending column index

   .. cpp:function:: int row_outline_level(int row, bool* collapsed = nullptr) const

      Get row outline level.

      :param row: Row index
      :param collapsed: Pointer to store collapse state
      :returns: Outline level

   .. cpp:function:: int col_outline_level(int col, bool* collapsed = nullptr) const

      Get column outline level.

      :param col: Column index
      :param collapsed: Pointer to store collapse state
      :returns: Outline level

   .. cpp:function:: int max_row_outline_level() const

      Get maximum row outline level.

      :returns: Maximum outline level

   .. cpp:function:: int max_col_outline_level() const

      Get maximum column outline level.

      :returns: Maximum outline level

   .. cpp:function:: void delete_row_outline()

      Remove all row outlining.

   .. cpp:function:: void delete_col_outline()

      Remove all column outlining.

   .. cpp:function:: bool group_summary_below() const

      Check if group summary rows are below detail.

      :returns: true if summary below detail

   .. cpp:function:: void set_group_summary_below(bool below)

      Set group summary row position.

      :param below: true for summary below detail, false for above

   .. cpp:function:: bool group_summary_right() const

      Check if group summary columns are to the right of detail.

      :returns: true if summary right of detail

   .. cpp:function:: void set_group_summary_right(bool right)

      Set group summary column position.

      :param right: true for summary right of detail, false for left

   Hyperlinks
   ~~~~~~~~~~

   .. cpp:function:: 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.

      :param hyperlink: URL or link address
      :param start_row: Starting row index
      :param start_col: Starting column index
      :param end_row: Ending row index
      :param end_col: Ending column index
      :returns: true if successful

   .. cpp:function:: int hyperlink_num() const

      Get number of hyperlinks.

      :returns: Number of hyperlinks

   .. cpp:function:: int hyperlink_index(int row, int col) const

      Get hyperlink index for a cell.

      :param row: Row index
      :param col: Column index
      :returns: Hyperlink index, or -1 if not found

   .. cpp:function:: const char* hyperlink(int index, int* start_row, int* start_col, int* end_row, int* end_col)

      Get hyperlink information.

      :param index: Hyperlink index
      :param start_row: Pointer to store starting row
      :param start_col: Pointer to store starting column
      :param end_row: Pointer to store ending row
      :param end_col: Pointer to store ending column
      :returns: Hyperlink address

   .. cpp:function:: bool delete_hyperlink(int index)

      Delete a hyperlink.

      :param index: Hyperlink index to delete
      :returns: true if successful

   Sheet Protection
   ~~~~~~~~~~~~~~~~

   .. cpp:function:: bool is_protected() const

      Check if worksheet is protected.

      :returns: true if protected

   .. cpp:function:: bool protect(SheetProtectEnum item = PROTECT_DEFAULT, const char* password = nullptr)

      Protect the worksheet.

      :param item: Protection options
      :param password: Optional password
      :returns: true if successful

   .. cpp:function:: void unprotect()

      Unprotect the worksheet.

   .. cpp:function:: bool protect_range(int start_row, int start_col, int end_row, int end_col)

      Protect specific cell range.

      :param start_row: Starting row index
      :param start_col: Starting column index
      :param end_row: Ending row index
      :param end_col: Ending column index
      :returns: true if successful

   .. cpp:function:: bool set_editable_range(int start_row, int start_col, int end_row, int end_col)

      Allow editing in specific range on protected sheet.

      :param start_row: Starting row index
      :param start_col: Starting column index
      :param end_row: Ending row index
      :param end_col: Ending column index
      :returns: true if successful

   .. cpp:function:: int editable_range_count() const

      Get number of editable ranges.

      :returns: Number of edit ranges

   .. cpp:function:: 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.

      :param index: Editable range index
      :param start_row: Pointer to store starting row
      :param start_col: Pointer to store starting column
      :param stop_row: Pointer to store ending row
      :param stop_col: Pointer to store ending column
      :returns: Range name

   .. cpp:function:: bool delete_editable_range(int index)

      Delete an editable range.

      :param index: Editable range index to delete
      :returns: true if successful

   View Settings
   ~~~~~~~~~~~~~

   .. cpp:function:: int zoom() const

      Get worksheet zoom level.

      :returns: Zoom percentage

   .. cpp:function:: void set_zoom(int zoom)

      Set worksheet zoom level.

      :param zoom: Zoom percentage

   .. cpp:function:: bool right_to_left() const

      Check if right-to-left display is enabled.

      :returns: true if right-to-left

   .. cpp:function:: void set_right_to_left(bool right_to_left = true)

      Set right-to-left display mode.

      :param right_to_left: true for right-to-left, false for left-to-right

   .. cpp:function:: void topleft_cell(int* row, int* col) const

      Get top-left visible cell.

      :param row: Pointer to store row index
      :param col: Pointer to store column index

   .. cpp:function:: void set_topleft_cell(int row, int col)

      Set top-left visible cell.

      :param row: Row index
      :param col: Column index

   .. cpp:function:: void active_cell(int* row, int* col) const

      Get active cell position.

      :param row: Pointer to store row index
      :param col: Pointer to store column index

   .. cpp:function:: void set_active_cell(int row, int col)

      Set active cell.

      :param row: Row index
      :param col: Column index

   .. cpp:function:: void split_cell(int* row, int* col) const

      Get split position.

      :param row: Pointer to store split row
      :param col: Pointer to store split column

   .. cpp:function:: void set_split_cell(int row, int col)

      Set split position.

      :param row: Split row index
      :param col: Split column index

   .. cpp:function:: bool display_gridlines() const

      Check if gridlines are displayed.

      :returns: true if gridlines visible

   .. cpp:function:: void set_display_gridlines(bool show = true)

      Set gridline visibility.

      :param show: true to show gridlines, false to hide

   Page Breaks
   ~~~~~~~~~~~

   .. cpp:function:: int row_break_count() const

      Get number of row page breaks.

      :returns: Number of row breaks

   .. cpp:function:: int row_break(int index) const

      Get row break position.

      :param index: Break index
      :returns: Row index of break

   .. cpp:function:: bool set_row_break(int row, bool pageBreak = true)

      Set row page break.

      :param row: Row index for break
      :param pageBreak: true for page break, false for manual break
      :returns: true if successful

   .. cpp:function:: int col_break_count() const

      Get number of column page breaks.

      :returns: Number of column breaks

   .. cpp:function:: int col_break(int index) const

      Get column break position.

      :param index: Break index
      :returns: Column index of break

   .. cpp:function:: bool set_col_break(int col, bool pageBreak = true)

      Set column page break.

      :param col: Column index for break
      :param pageBreak: true for page break, false for manual break
      :returns: true if successful

   Print Settings
   ~~~~~~~~~~~~~~

   .. cpp:function:: bool print_gridlines() const

      Check if gridlines are printed.

      :returns: true if gridlines will print

   .. cpp:function:: void set_print_gridlines(bool print = true)

      Set gridline printing.

      :param print: true to print gridlines

   .. cpp:function:: bool print_headings() const

      Check if headings are printed.

      :returns: true if headings will print

   .. cpp:function:: void set_print_headings(bool print = false)

      Set heading printing.

      :param print: true to print headings

   .. cpp:function:: bool h_centered_printing() const

      Check if horizontal centering is enabled for printing.

      :returns: true if horizontally centered

   .. cpp:function:: void set_h_centered_printing(bool centered = true)

      Set horizontal centering for printing.

      :param centered: true to center horizontally

   .. cpp:function:: bool v_centered_printing() const

      Check if vertical centering is enabled for printing.

      :returns: true if vertically centered

   .. cpp:function:: void set_v_centered_printing(bool centered = true)

      Set vertical centering for printing.

      :param centered: true to center vertically

   Page Margins
   ~~~~~~~~~~~~

   .. cpp:function:: double left_margin() const

      Get left margin.

      :returns: Left margin value

   .. cpp:function:: void set_left_margin(double value)

      Set left margin.

      :param value: Margin value

   .. cpp:function:: double right_margin() const

      Get right margin.

      :returns: Right margin value

   .. cpp:function:: void set_right_margin(double value)

      Set right margin.

      :param value: Margin value

   .. cpp:function:: double top_margin() const

      Get top margin.

      :returns: Top margin value

   .. cpp:function:: void set_top_margin(double value)

      Set top margin.

      :param value: Margin value

   .. cpp:function:: double bottom_margin() const

      Get bottom margin.

      :returns: Bottom margin value

   .. cpp:function:: void set_bottom_margin(double value)

      Set bottom margin.

      :param value: Margin value

   .. cpp:function:: double header_margin() const

      Get header margin.

      :returns: Header margin value

   .. cpp:function:: void set_header_margin(double value)

      Set header margin.

      :param value: Margin value

   .. cpp:function:: double footer_margin() const

      Get footer margin.

      :returns: Footer margin value

   .. cpp:function:: void set_footer_margin(double value)

      Set footer margin.

      :param value: Margin value

   Page Setup
   ~~~~~~~~~~

   .. cpp:function:: int paper() const

      Get paper size code.

      :returns: Paper size code

   .. cpp:function:: bool set_paper(int paper_code)

      Set paper size.

      :param paper_code: Paper size code
      :returns: true if successful

   .. cpp:function:: int print_scale() const

      Get print scale.

      :returns: Print scale percentage

   .. cpp:function:: void set_print_scale(int zoom)

      Set print scale.

      :param zoom: Scale percentage

   .. cpp:function:: PageOrientEnum page_orientation() const

      Get page orientation.

      :returns: Page orientation

   .. cpp:function:: void set_page_orientation(PageOrientEnum orientation)

      Set page orientation.

      :param orientation: Orientation to set

   .. cpp:function:: PrintErrorEnum print_errors() const

      Get error printing method.

      :returns: Error printing method

   .. cpp:function:: void set_print_errors(PrintErrorEnum way)

      Set how errors are printed.

      :param way: Error printing method

   .. cpp:function:: int fit_page_height() const

      Get fit to page height setting.

      :returns: Number of pages high to fit

   .. cpp:function:: void set_fit_page_height(int num)

      Set fit to page height.

      :param num: Number of pages high to fit (0 to disable)

   .. cpp:function:: int fit_page_width() const

      Get fit to page width setting.

      :returns: Number of pages wide to fit

   .. cpp:function:: void set_fit_page_width(int num)

      Set fit to page width.

      :param num: Number of pages wide to fit (0 to disable)

   Headers and Footers
   ~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: const char* page_header() const

      Get page header.

      :returns: Header text

   .. cpp:function:: void set_page_header(const char* header)

      Set page header.

      :param header: Header text

   .. cpp:function:: const char* page_footer() const

      Get page footer.

      :returns: Footer text

   .. cpp:function:: void set_page_footer(const char* footer)

      Set page footer.

      :param footer: Footer text

Usage Example
-------------

.. code-block:: cpp

   #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);
