.. _style-api:

Style Interface
===============

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

Classes
-------

.. cpp:class:: oo::iStyle

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

   Number Formatting
   ~~~~~~~~~~~~~~~~~

   .. cpp:function:: int set_numfmt_code(const char* numFmtCode)

      Set built-in or custom number format code.

      :param numFmtCode: Custom number format string (e.g., "0.00", "mm/dd/yyyy")
      :returns: Format ID if successful, -1 if failed

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

      Get the number format code.

      :returns: Number format code string

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

      Get the number format ID.

      :returns: Nnumber format ID

   .. cpp:function:: bool set_numfmt_id(int numFmtId)

      Set number format by ID.

      :param numFmtId: Number format identifier
      :returns: true if successful

   Font Properties
   ~~~~~~~~~~~~~~~

   .. cpp:function:: void set_font(const char* name, int fontSize = 0)

      Set font name and size.

      :param name: Font family name
      :param fontSize: Font size in points (0 keeps current size)

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

      Get font name.

      :returns: Font family name

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

      Get font size.

      :returns: Font size in points

   .. cpp:function:: void set_font_size(int size)

      Set font size.

      :param size: Font size in points

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

      Check if font is italic.

      :returns: true if italic

   .. cpp:function:: void set_italic(bool italic = true)

      Set italic font style.

      :param italic: true for italic, false for normal

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

      Check if font has strikeout.

      :returns: true if strikeout enabled

   .. cpp:function:: void set_strikeout(bool strikeOut = true)

      Set strikeout font style.

      :param strikeOut: true for strikeout, false for normal

   .. cpp:function:: COLORREF font_color() const

      Get font color.

      :returns: Font color as COLORREF

   .. cpp:function:: void set_font_color(COLORREF color)

      Set font color.

      :param color: Font color as COLORREF

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

      Check if font is bold.

      :returns: true if bold

   .. cpp:function:: void set_bold(bool bold = true)

      Set bold font weight.

      :param bold: true for bold, false for normal

   .. cpp:function:: VertAlignRunEnum font_vert_align() const

      Get font vertical alignment.

      :returns: Vertical alignment type

   .. cpp:function:: void set_font_vert_align(VertAlignRunEnum v_alignRun)

      Set font vertical alignment.

      :param v_alignRun: Vertical alignment type

   .. cpp:function:: UnderlineEnum underlined() const

      Get underline style.

      :returns: Underline type

   .. cpp:function:: void set_underline(UnderlineEnum underline)

      Set underline style.

      :param underline: Underline type

   Border Properties
   ~~~~~~~~~~~~~~~~~

   .. cpp:function:: BorderStyleEnum border(BorderIndexEnum index) const

      Get border style for specific edge.

      :param index: Border edge identifier
      :returns: Border style

   .. cpp:function:: bool set_border(BorderIndexEnum index, BorderStyleEnum style)

      Set border style for specific edge.

      :param index: Border edge identifier
      :param style: Border style to set
      :returns: true if successful

   .. cpp:function:: COLORREF border_color(BorderIndexEnum index) const

      Get border color for specific edge.

      :param index: Border edge identifier
      :returns: Border color as COLORREF

   .. cpp:function:: bool set_border_color(BorderIndexEnum index, COLORREF color)

      Set border color for specific edge.

      :param index: Border edge identifier
      :param color: Border color to set
      :returns: true if successful

   Fill and Pattern Properties
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: PatternTypeEnum fill_pattern() const

      Get fill pattern type.

      :returns: Fill pattern type

   .. cpp:function:: void set_fill_pattern(PatternTypeEnum pattern)

      Set fill pattern type.

      :param pattern: Fill pattern type

   .. cpp:function:: COLORREF pattern_fg_color() const

      Get pattern foreground color.

      :returns: Foreground color as COLORREF

   .. cpp:function:: void set_pattern_fg_color(COLORREF color)

      Set pattern foreground color.

      :param color: Foreground color

   .. cpp:function:: COLORREF pattern_bg_color() const

      Get pattern background color.

      :returns: Background color as COLORREF

   .. cpp:function:: void set_pattern_bg_color(COLORREF color)

      Set pattern background color.

      :param color: Background color

   Alignment Properties
   ~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: HAlignEnum align_h() const

      Get horizontal alignment.

      :returns: Horizontal alignment type

   .. cpp:function:: void set_align_h(HAlignEnum h_alignment)

      Set horizontal alignment.

      :param h_alignment: Horizontal alignment type

   .. cpp:function:: VAlignEnum align_v() const

      Get vertical alignment.

      :returns: Vertical alignment type

   .. cpp:function:: void set_align_v(VAlignEnum v_alignment)

      Set vertical alignment.

      :param v_alignment: Vertical alignment type

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

      Check if text wrapping is enabled.

      :returns: true if text wrapping enabled

   .. cpp:function:: void set_wrap(bool wrap = true)

      Set text wrapping.

      :param wrap: true to enable text wrapping

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

      Get text rotation angle.

      :returns: Text rotation in degrees

   .. cpp:function:: void set_rotation(int rotation)

      Set text rotation.

      :param rotation: Text rotation in degrees (-90 to 90)

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

      Get the number of characters for text indentation.

      :returns: Number of characters


   .. cpp:function:: void set_indent(int indent)

      Set the number of characters for text indentation.

      :param indent: Number of characters

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

      Check if shrink to fit is enabled.

      :returns: true if shrink to fit enabled

   .. cpp:function:: void set_shrink_to_fit(bool shrinkToFit = true)

      Set shrink to fit property.

      :param shrinkToFit: true to enable shrink to fit

   Protection Properties
   ~~~~~~~~~~~~~~~~~~~~~

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

      Check if cell is locked.

      :returns: true if cell locked

   .. cpp:function:: void set_locked(bool locked = true)

      Set cell lock status.

      :param locked: true to lock cell

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

      Check if cell is hidden.

      :returns: true if cell hidden

   .. cpp:function:: void set_hidden(bool hidden = true)

      Set cell visibility.

      :param hidden: true to hide cell

   Style Removal Methods
   ~~~~~~~~~~~~~~~~~~~~~

   .. cpp:function:: void unapply_numfmt()

      Remove number formatting from style.

   .. cpp:function:: void unapply_font()

      Remove font formatting from style.

   .. cpp:function:: void unapply_fill()

      Remove fill formatting from style.

   .. cpp:function:: void unapply_border()

      Remove border formatting from style.

   .. cpp:function:: void unapply_alignment()

      Remove alignment formatting from style.

   .. cpp:function:: void unapply_protection()

      Remove protection formatting from style.

   .. cpp:function:: void unapply_all()

      Remove all formatting from style.

   Resource Management
   ~~~~~~~~~~~~~~~~~~~

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