# Document Interface

The Document interface represents the main document object that manages Excel workbooks.

## Classes

class oo::iDocument

  Main document interface for creating and managing Excel workbooks.

  oo::iWorkbook *get_workbook()

    Get the workbook associated with this document.

    Returns:

      Pointer to the workbook interface

  bool save(const char *filename = nullptr)

    Save the document to a file.

    Parameters:

      filename – Path to save the document. If null, saves to current file.

    Returns:

      true if successful, false otherwise

  void release()

    Release the document and free associated resources.

    Warning

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

## Global Functions

oo::iDocument *create_document()

  Create a new empty document.

  Returns:

    Pointer to newly created document

oo::iDocument *load_document(const char *filename)

  Load an existing document from file.

  Parameters:

    filename – Path to the Excel file to load

  Returns:

    Pointer to loaded document, or nullptr if failed

const char *lib_version()

  Get the library version string.

  Returns:

    Constant string containing library version information

## Usage Example

    #include "oosxl.hxx"

    // Create a new document
    oo::iDocument* doc = create_document();

    if (doc) {
        // Get workbook and work with sheets
        oo::iWorkbook* workbook = doc->get_workbook();

        // Perform operations...

        // Save document
        doc->save("example.xlsx");

        // Clean up
        doc->release();
    }

Styled using the Piccolo Theme