Style Interface — oosxl 0.1.0 documentation

# Style Interface

The Style interface represents cell formatting properties including number formats, fonts, borders, fills, alignment, and protection settings.

## Classes

class oo::iStyle

  Cell formatting interface for managing number formats, fonts, borders, fills, alignment, and protection.

  ### Number Formatting

  int set_numfmt_code(const char *numFmtCode)

    Set built-in or custom number format code.

    Parameters:

      numFmtCode – Custom number format string (e.g., “0.00”, “mm/dd/yyyy”)

    Returns:

      Format ID if successful, -1 if failed

  const char *numfmt_code() const

    Get the number format code.

    Returns:

      Number format code string

  int numfmt_id() const

    Get the number format ID.

    Returns:

      Nnumber format ID

  bool set_numfmt_id(int numFmtId)

    Set number format by ID.

    Parameters:

      numFmtId – Number format identifier

    Returns:

      true if successful

  ### Font Properties

  void set_font(const char *name, int fontSize = 0)

    Set font name and size.

    Parameters:

      - name – Font family name

      - fontSize – Font size in points (0 keeps current size)

  const char *font_name() const

    Get font name.

    Returns:

      Font family name

  int font_size() const

    Get font size.

    Returns:

      Font size in points

  void set_font_size(int size)

    Set font size.

    Parameters:

      size – Font size in points

  bool italic() const

    Check if font is italic.

    Returns:

      true if italic

  void set_italic(bool italic = true)

    Set italic font style.

    Parameters:

      italic – true for italic, false for normal

  bool strikeout() const

    Check if font has strikeout.

    Returns:

      true if strikeout enabled

  void set_strikeout(bool strikeOut = true)

    Set strikeout font style.

    Parameters:

      strikeOut – true for strikeout, false for normal

  COLORREF font_color() const

    Get font color.

    Returns:

      Font color as COLORREF

  void set_font_color(COLORREF color)

    Set font color.

    Parameters:

      color – Font color as COLORREF

  bool bold() const

    Check if font is bold.

    Returns:

      true if bold

  void set_bold(bool bold = true)

    Set bold font weight.

    Parameters:

      bold – true for bold, false for normal

  VertAlignRunEnum font_vert_align() const

    Get font vertical alignment.

    Returns:

      Vertical alignment type

  void set_font_vert_align(VertAlignRunEnum v_alignRun)

    Set font vertical alignment.

    Parameters:

      v_alignRun – Vertical alignment type

  UnderlineEnum underlined() const

    Get underline style.

    Returns:

      Underline type

  void set_underline(UnderlineEnum underline)

    Set underline style.

    Parameters:

      underline – Underline type

  ### Border Properties

  BorderStyleEnum border(BorderIndexEnum index) const

    Get border style for specific edge.

    Parameters:

      index – Border edge identifier

    Returns:

      Border style

  bool set_border(BorderIndexEnum index, BorderStyleEnum style)

    Set border style for specific edge.

    Parameters:

      - index – Border edge identifier

      - style – Border style to set

    Returns:

      true if successful

  COLORREF border_color(BorderIndexEnum index) const

    Get border color for specific edge.

    Parameters:

      index – Border edge identifier

    Returns:

      Border color as COLORREF

  bool set_border_color(BorderIndexEnum index, COLORREF color)

    Set border color for specific edge.

    Parameters:

      - index – Border edge identifier

      - color – Border color to set

    Returns:

      true if successful

  ### Fill and Pattern Properties

  PatternTypeEnum fill_pattern() const

    Get fill pattern type.

    Returns:

      Fill pattern type

  void set_fill_pattern(PatternTypeEnum pattern)

    Set fill pattern type.

    Parameters:

      pattern – Fill pattern type

  COLORREF pattern_fg_color() const

    Get pattern foreground color.

    Returns:

      Foreground color as COLORREF

  void set_pattern_fg_color(COLORREF color)

    Set pattern foreground color.

    Parameters:

      color – Foreground color

  COLORREF pattern_bg_color() const

    Get pattern background color.

    Returns:

      Background color as COLORREF

  void set_pattern_bg_color(COLORREF color)

    Set pattern background color.

    Parameters:

      color – Background color

  ### Alignment Properties

  HAlignEnum align_h() const

    Get horizontal alignment.

    Returns:

      Horizontal alignment type

  void set_align_h(HAlignEnum h_alignment)

    Set horizontal alignment.

    Parameters:

      h_alignment – Horizontal alignment type

  VAlignEnum align_v() const

    Get vertical alignment.

    Returns:

      Vertical alignment type

  void set_align_v(VAlignEnum v_alignment)

    Set vertical alignment.

    Parameters:

      v_alignment – Vertical alignment type

  bool wrap() const

    Check if text wrapping is enabled.

    Returns:

      true if text wrapping enabled

  void set_wrap(bool wrap = true)

    Set text wrapping.

    Parameters:

      wrap – true to enable text wrapping

  int rotation() const

    Get text rotation angle.

    Returns:

      Text rotation in degrees

  void set_rotation(int rotation)

    Set text rotation.

    Parameters:

      rotation – Text rotation in degrees (-90 to 90)

  int indent() const

    Get the number of characters for text indentation.

    Returns:

      Number of characters

  void set_indent(int indent)

    Set the number of characters for text indentation.

    Parameters:

      indent – Number of characters

  bool shrink_to_fit() const

    Check if shrink to fit is enabled.

    Returns:

      true if shrink to fit enabled

  void set_shrink_to_fit(bool shrinkToFit = true)

    Set shrink to fit property.

    Parameters:

      shrinkToFit – true to enable shrink to fit

  ### Protection Properties

  bool locked() const

    Check if cell is locked.

    Returns:

      true if cell locked

  void set_locked(bool locked = true)

    Set cell lock status.

    Parameters:

      locked – true to lock cell

  bool hidden() const

    Check if cell is hidden.

    Returns:

      true if cell hidden

  void set_hidden(bool hidden = true)

    Set cell visibility.

    Parameters:

      hidden – true to hide cell

  ### Style Removal Methods

  void unapply_numfmt()

    Remove number formatting from style.

  void unapply_font()

    Remove font formatting from style.

  void unapply_fill()

    Remove fill formatting from style.

  void unapply_border()

    Remove border formatting from style.

  void unapply_alignment()

    Remove alignment formatting from style.

  void unapply_protection()

    Remove protection formatting from style.

  void unapply_all()

    Remove all formatting from style.

  ### Resource Management

  void release()

    Release the style object and free associated resources.

    Note

    This should be called when the style is no longer needed to prevent memory leaks.

Styled using the Piccolo Theme