Skip to content

C API ​

The C11 ABI is the integration surface for a custom language binding or a native host. It is a flat API over an opaque fm_workbook_t handle; the shipped Python, CLI, and WASM surfaces use the same model. Public record layouts are part of the contract and must match the header used to build the client.

The ABI is not shipped as a prebuilt package. Build from source (Build from source), include src/c_api/formulon_c.h, and link the formulon_static archive, or the shared formulon library that -DFM_BUILD_C_API_SHARED=ON adds. The header is the exhaustive reference; this page covers the ownership and lifetime rules a binding must implement correctly, plus a map of the function families.

Minimal workbook round trip ​

All workbook coordinates are zero-based: (0, 0, 0) is Sheet1!A1. Check the fm_status_t returned by every fallible call. A status of 0 means success.

c
#include "formulon_c.h"
#include <stdint.h>
#include <stdio.h>

static void report_failure(const char *operation, fm_status_t status) {
  fprintf(stderr, "%s: %s: %s\n", operation, fm_status_string(status),
          fm_last_error_message());
}

int main(void) {
  fm_workbook_t *wb = NULL;
  uint8_t *bytes = NULL;
  size_t len = 0;
  fm_value_t value;

  fm_status_t status = fm_workbook_create(&wb);
  if (status != 0) { report_failure("create", status); return 1; }

  status = fm_workbook_set_formula(wb, 0, 0, 0, "=SUM(1,2,3)");
  if (status == 0) status = fm_workbook_recalc(wb);
  if (status == 0) status = fm_workbook_get_value(wb, 0, 0, 0, &value);
  if (status == 0 && value.kind == FM_VAL_NUMBER) printf("%.0f\n", value.u.number);
  if (status == 0) status = fm_workbook_save(wb, &bytes, &len);
  if (status != 0) report_failure("workbook operation", status);

  /* Write `bytes[0..len]` wherever the host stores the .xlsx file. */
  fm_buffer_free(bytes);
  fm_workbook_destroy(wb);
  return status == 0 ? 0 : 1;
}

To begin from an existing .xlsx or .xlsb, call fm_workbook_load(input_bytes, input_len, &wb) in place of fm_workbook_create(). The reader detects the container from its bytes.

fm_workbook_create_for_profile(profile_id, &wb) creates one sheet with the selected Excel profile's new-workbook defaults. It records the profile and seeds the locale-specific body and optional phonetic fonts, Normal style and first-sheet names, cell-xf alignment, phonetic settings, page margins, and measured Mac row and column defaults. fm_workbook_create() remains the ordinary Calibri 11 workbook; the profile factory writes no theme part, so Excel's default Office theme is used.

Ownership and views ​

ValueOwnerRule
fm_workbook_t *callerRelease with fm_workbook_destroy(). NULL is allowed.
Byte buffers from fm_workbook_save, fm_workbook_save_as, fm_workbook_save_with_diagnostics, fm_sheet_snapshot_range_style, fm_sheet_snapshot_drawingcaller after successRelease only with fm_buffer_free(), never free() or delete[].
fm_value_t.u.text and text gettersworkbookCopy before another successful scratch-backed read, any mutation, or handle destruction.
Error message and contextcurrent threadCopy before the next API call on that thread.
Formula text from fm_formula_localize / fm_formula_canonicalizecurrent threadValid until the next call to either function on that thread.
fm_version_string(), fm_status_string(), fm_error_display_name(), function names, locale factsprocessStatic; never free.
fm_cell_range_t *callerRelease with fm_cell_range_destroy(). Cell text and formulas in the snapshot remain valid until destruction.
fm_pagination_t *callerRelease with fm_pagination_destroy(). All pagination getters read the owned result.
fm_cf_results_t * from fm_workbook_cf_evaluate_rangecallerRelease with fm_cf_results_destroy().
fm_cell_nodes_t * from fm_workbook_precedents / fm_workbook_dependentscallerRelease with fm_cell_nodes_destroy().
fm_pivot_cells_t * from fm_workbook_pivot_layoutcallerRelease with fm_pivot_cells_destroy().

Every call that returns an owned handle or buffer sets the output to NULL (and the length to 0) before validation and leaves it there on failure, and fm_buffer_free(NULL) is safe. That makes the unconditional cleanup in the example valid.

fm_sheet_cells_in_range() returns an owned page snapshot through fm_cell_range_t. The page contains populated cells and spill phantoms in row-major order; fm_cell_range_count(), fm_cell_range_at(), and fm_cell_range_next_cursor() read it without touching workbook scratch storage. Later workbook mutations do not change the snapshot. Destroy every successful page with fm_cell_range_destroy() and pass its cursor to the next call.

Errors and threads ​

Cell-level Excel errors such as #DIV/0! are values (FM_VAL_ERROR), not failed statuses. A non-zero fm_status_t reports a host-side failure such as invalid input, an invalid handle, or an I/O error. Read fm_last_error_message() and fm_last_error_context() before making another API call on the same thread; both views are thread-local and overwritten by that next call.

Text arguments and struct text fields must be well-formed UTF-8. A surrogate code point, an overlong form, or a truncated sequence returns kBindingUtf8EncodingError (7002) and leaves the workbook unchanged; a binding that holds UTF-16 text replaces a lone surrogate with U+FFFD before the call. Index, count, and outline-level arguments are range-checked before anything changes: an outline level above 7, an xf_index outside the cell-XF table, and hiding or removing the only visible sheet return kInvalidArgument. Every binding reports the same statuses. Row and column inserts and deletes that cut through a data table, a legacy array block, or a PivotTable, or that would push one of them or a table past the grid edge, return kPreconditionFailed, as does a cell write into a data table's result range.

A workbook handle belongs to one external caller thread at a time. Do not concurrently read, mutate, or recalculate the same handle. fm_workbook_recalc_parallel() may create internal worker threads for one call, but it does not make independent calls on that handle safe. Separate handles can be driven concurrently.

Selected contracts ​

fm_workbook_get_iterative() reads enabled, max_iterations, and max_change; fm_workbook_set_iterative() clamps the iteration cap to 32767 and the getter reports the clamped value. fm_sheet_set_visibility() accepts FM_SHEET_VISIBLE, FM_SHEET_HIDDEN, or FM_SHEET_VERY_HIDDEN, while fm_sheet_get_view() reports both the legacy tab_hidden flag and the authoritative three-state visibility.

Typed worksheet print setters cover page setup, margins, print options, header/footer, print area, print titles, and manual row/column breaks (fm_sheet_set_page_setup, fm_sheet_set_page_margins, fm_sheet_set_print_options, fm_sheet_set_header_footer, fm_sheet_set_print_area, fm_sheet_set_print_titles, fm_sheet_add_row_break, and fm_sheet_add_col_break). Raw XML setters validate well-formed, bounded fragments before storing them. fm_sheet_set_range_xf_index() applies one style XF index over an inclusive rectangle and materializes styled blank cells.

fm_workbook_pivot_field_add_item_at() addresses a manual-filter item by its cache shared-item index. It is the form that can express a blank pivot member; the label-based fm_workbook_pivot_field_add_item() cannot identify that member with an empty string.

External workbook references are metadata and cached-value inputs. The XLSX and XLSB readers accept both index-spelled references such as [1]Sheet1!A1 and named/path-spelled references such as [Book1.xlsx]Sheet1!A1; the engine resolves the value already cached in the package and never opens the referenced workbook or performs network I/O. fm_workbook_external_link_count() and fm_workbook_external_link_at() expose the link records for a host-side compatibility check.

fm_workbook_paginate() returns an owned fm_pagination_t snapshot. In addition to page count, declared print-area rectangles, and horizontal / vertical break positions, the getters expose paper size and orientation, margins, printable rectangle, scale, page order, repeated print titles, each physical page layout, and whether each break was manual. A missing declared print area remains empty even when pagination falls back to the used range. Destroy the result with fm_pagination_destroy().

The public records use fixed layouts, and a client compiled against an earlier header must be recompiled. On 64-bit targets fm_sheet_view_t is 88 bytes, fm_font_record 120, fm_fill_record 128, fm_cell_xf 128, fm_sheet_format_defaults 56, and fm_column_layout_t and fm_row_layout_t 40 each. fm_dxf_record embeds the font and fill records and grows with them. fm_cf_rule_t ends with icon_set_icons / icon_set_icon_count, and fm_pivot_field_info_t with default_subtotal / subtotal_fns. fm_locale_facts_t ends with the collation_measured field, which is part of the record layout and distinguishes measured text collation from other locale facts. The public formulon_c.h header is authoritative: rebuild C clients and regenerate any FFI layout whenever it changes; field order and padding are part of the ABI.

fm_sheet_format_defaults has default_col_width, default_row_height, base_col_width, has_default_col_width, has_default_row_height, custom_height, zero_height, and then effective_default_col_width and effective_default_row_height. Column widths are stored widths with the column padding included, as <col width> holds them, and heights are points. fm_sheet_get_format_defaults() fills the effective fields using either the stored defaults or the values derived from base_col_width and the Normal font (Calibri 11 with base width 8 stores 9.140625, shown as 8.43, and the row height is 102/7 points); fm_sheet_set_format_defaults() ignores those two effective fields and rejects negative, NaN, or infinite stated values.

Function metadata is structural and locale-invariant. Use the profile-based helpers when a host needs Excel's display spelling:

c
/* Status checks omitted. */
const char* localized = NULL;
const char* canonical = NULL;
const char* shown = NULL;
const char* stored = NULL;
char shown_copy[256];
fm_locale_facts_t facts = {0};

fm_function_localize("SUM", "mac-365-de_DE", &localized);        /* "SUMME" */
fm_function_canonicalize(localized, "mac-365-de_DE", &canonical); /* "SUM" */
fm_formula_localize("=SUM(1.5,TRUE)", "mac-365-de_DE", &shown);
/* The next call reuses the thread-local buffer `shown` points into. */
snprintf(shown_copy, sizeof shown_copy, "%s", shown);
fm_formula_canonicalize(shown_copy, "mac-365-de_DE", &stored);
fm_locale_facts("mac-365-de_DE", &facts);

All five functions take a profile id, not a numeric locale code. fm_locale_facts_t reports separators, Boolean names, date order, currency, measured, and the separate collation_measured flag; only mac-* profiles have measured text collation.

fm_text_compare(a, b, profile_id, strength, &order) writes -1, 0, or 1 for two UTF-8 texts under FM_COLLATION_COMPARE, FM_COLLATION_DYNAMIC, or FM_COLLATION_CLASSIC_EXACT. fm_collation_classes(values, count, profile_id, strength, class_ids, &class_count) writes one dense class id per fm_value_t, ascending in SORT order and meaningful only within that call. The profile id comes before the strength here, unlike the JavaScript and Python argument order. Text collation defines the folds and class rules.

fm_workbook_set_formula() validates formula text before changing the cell. A malformed formula returns the kParserUnexpectedToken status and leaves the previous formula and cached state unchanged. A malformed formula already present in an XLSX or XLSB file is loaded as stored text; recalculation exposes #NAME? as a cell error rather than failing the workbook load.

Named styles use fm_cell_style_record_t with name, xf_id, builtin_id, i_level, hidden, and custom_builtin. Read them with fm_styles_get_cell_style() and write them with fm_styles_set_cell_style(). xf_id indexes the named-style cellStyleXfs table; builtin_id is 0..53 or FM_CELL_STYLE_BUILTIN_ID_NONE for a custom style. i_level is 0..6 for the built-in RowLevel_n / ColLevel_n styles and 0 otherwise. The returned name is workbook-owned; the setter copies its input.

Row and column styles (fm_sheet_set_column_style(), fm_sheet_set_row_style() and their clear counterparts), fm_cell_clear_xf_index(), and the fm_sheet_range_style_bases() → fm_sheet_remap_range_style() edit with its fm_sheet_snapshot_range_style() / fm_sheet_restore_range_style() undo capture follow the rules in Workbook operations. The snapshot is an opaque byte buffer released with fm_buffer_free(). Theme script fonts (fm_workbook_theme_script_font_count() / _at(), fm_workbook_set_theme_script_font()) follow Presentation and geometry.

Function families ​

Every declaration in formulon_c.h states its pointer lifetime beside it. The tables below are generated from every FM_API declaration in src/c_api/formulon_c.h. A summary is the first sentence of the declaration's Doxygen comment; declarations grouped under one comment share its summary.

Reference source

These tables are generated from the core source for documentation target 0.18.0. The source commit is pinned so WASM, Python, and C declarations describe the same revision. Demos use published packages and display their runtime version separately.

Library, diagnostics and logging ​

NameSignatureDescription
fm_buffer_freevoid fm_buffer_free(uint8_t* bytes)Releases a buffer returned by any Formulon save API returning out_bytes: fm_workbook_save, fm_workbook_save_as, or fm_workbook_save_with_diagnostics.
fm_last_error_messageconst char* fm_last_error_message(void)Returns the most recent error message produced by an API call on the current thread.
fm_last_error_contextconst char* fm_last_error_context(void)Returns the optional context string associated with the most recent error on the current thread.
fm_status_stringconst char* fm_status_string(fm_status_t status)Returns a static C string describing status.
fm_error_display_nameconst char* fm_error_display_name(fm_error_code_t error)Returns the Excel display literal for a cell error code.
fm_set_log_min_levelfm_status_t fm_set_log_min_level(int32_t level)Sets the lowest severity the engine emits, process-wide.
fm_set_log_sinkfm_status_t fm_set_log_sink(fm_log_sink_cb sink, void* user_data)Routes structured-log records to sink instead of stderr.
fm_version_stringconst char* fm_version_string(void)Returns the Formulon library version as a NUL-terminated UTF-8 string.

Workbook lifecycle and I/O ​

NameSignatureDescription
fm_workbook_createfm_status_t fm_workbook_create(fm_workbook_t** out)Builds a default workbook (a single sheet named "Sheet1").
fm_workbook_create_for_profilefm_status_t fm_workbook_create_for_profile(const char* profile_id, fm_workbook_t** out)Builds a workbook with the new-workbook defaults of an Excel profile.
fm_workbook_create_emptyfm_status_t fm_workbook_create_empty(fm_workbook_t** out)Builds an empty workbook (no sheets).
fm_workbook_loadfm_status_t fm_workbook_load(const uint8_t* bytes, size_t len, fm_workbook_t** out)Loads a workbook from an in-memory .xlsx or .xlsb buffer.
fm_workbook_read_diagnosticsfm_status_t fm_workbook_read_diagnostics(const fm_workbook_t* wb, fm_read_diagnostics_t* out_diagnostics)Returns the load diagnostics captured when wb was created.
fm_workbook_memory_usagefm_status_t fm_workbook_memory_usage(const fm_workbook_t* wb, size_t* out_bytes)Reports the estimated heap footprint of wb in bytes.
fm_workbook_destroyvoid fm_workbook_destroy(fm_workbook_t* wb)Releases a workbook handle.
fm_workbook_savefm_status_t fm_workbook_save(const fm_workbook_t* wb, uint8_t** out_bytes, size_t* out_len)Serialises the workbook to an in-memory .xlsx byte stream.
fm_workbook_save_asfm_status_t fm_workbook_save_as(const fm_workbook_t* wb, int32_t format, uint8_t** out_bytes, size_t* out_len)Serialises the workbook to an in-memory byte stream in the requested container format.
fm_workbook_save_with_diagnosticsfm_status_t fm_workbook_save_with_diagnostics(const fm_workbook_t* wb, int32_t format, uint8_t** out_bytes, size_t* out_len, fm_save_diagnostics_t* out_diagnostics)Serialises wb and reports what the save cost.
fm_workbook_passthrough_countsize_t fm_workbook_passthrough_count(const fm_workbook_t* wb)Returns the number of passthrough OOXML parts the reader carried through unchanged.
fm_workbook_passthrough_atfm_status_t fm_workbook_passthrough_at(const fm_workbook_t* wb, size_t idx, const char** out_path)Reads the idx-th passthrough part's path.

Sheets and structure ​

NameSignatureDescription
fm_workbook_sheet_countsize_t fm_workbook_sheet_count(const fm_workbook_t* wb)Returns the number of sheets in the workbook.
fm_workbook_sheet_namefm_status_t fm_workbook_sheet_name(const fm_workbook_t* wb, size_t index, const char** out_utf8)Returns the display name of the sheet at index (UTF-8).
fm_workbook_add_sheetfm_status_t fm_workbook_add_sheet(fm_workbook_t* wb, const char* utf8_name)Appends a new sheet with the given UTF-8 display name.
fm_workbook_move_sheetfm_status_t fm_workbook_move_sheet(fm_workbook_t* wb, uint32_t from_index, uint32_t to_index)Moves the sheet at from_index to to_index.
fm_workbook_get_active_sheetfm_status_t fm_workbook_get_active_sheet(const fm_workbook_t* wb, uint32_t* out_index)Reads the active sheet: the first <workbookView>'s activeTab.
fm_workbook_set_active_sheetfm_status_t fm_workbook_set_active_sheet(fm_workbook_t* wb, uint32_t index)Marks sheet index active so a save records it.
fm_workbook_remove_sheetfm_status_t fm_workbook_remove_sheet(fm_workbook_t* wb, uint32_t index)Removes the sheet at index.
fm_workbook_rename_sheetfm_status_t fm_workbook_rename_sheet(fm_workbook_t* wb, uint32_t index, const char* new_name)Renames the sheet at index to new_name (UTF-8).
fm_workbook_insert_rowsfm_status_t fm_workbook_insert_rows(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t count)Inserts count rows at row on sheet.
fm_workbook_delete_rowsfm_status_t fm_workbook_delete_rows(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t count)Deletes count rows starting at row on sheet.
fm_workbook_insert_colsfm_status_t fm_workbook_insert_cols(fm_workbook_t* wb, uint32_t sheet, uint32_t col, uint32_t count)Inserts count columns at col on sheet.
fm_workbook_delete_colsfm_status_t fm_workbook_delete_cols(fm_workbook_t* wb, uint32_t sheet, uint32_t col, uint32_t count)Deletes count columns starting at col on sheet.

Cells ​

NameSignatureDescription
fm_workbook_set_numberfm_status_t fm_workbook_set_number(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, double value)Stores a numeric literal at (row, col) on the given sheet.
fm_workbook_set_boolfm_status_t fm_workbook_set_bool(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, int32_t value)Stores a boolean literal.
fm_workbook_set_errorfm_status_t fm_workbook_set_error(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, fm_error_code_t error)Stores a static Excel error literal at (row, col).
fm_workbook_set_textfm_status_t fm_workbook_set_text(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char* utf8)Stores a text literal.
fm_workbook_set_cell_phoneticfm_status_t fm_workbook_set_cell_phonetic(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char* utf8)Stores a whole-cell phonetic guide (OOXML <rPh>).
fm_workbook_set_cell_phonetic_runsfm_status_t fm_workbook_set_cell_phonetic_runs(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const fm_phonetic_run_t* runs, size_t count)Stores a cell's phonetic guide as one <rPh> block per run, spans included.
fm_workbook_set_cell_phonetic_propertiesfm_status_t fm_workbook_set_cell_phonetic_properties(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, uint32_t font_id, uint32_t type, uint32_t alignment)Stores how a cell's phonetic guide renders (OOXML <phoneticPr>).
fm_workbook_set_blankfm_status_t fm_workbook_set_blank(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col)Stores a Blank literal at (row, col).
fm_workbook_set_formulafm_status_t fm_workbook_set_formula(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char* formula)Stores a formula at (row, col) and registers its dependencies.
fm_workbook_get_valuefm_status_t fm_workbook_get_value(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, fm_value_t* out)Reads the cached cell value at (row, col).
fm_workbook_get_cell_phoneticfm_status_t fm_workbook_get_cell_phonetic(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char** out_text)Reads the cell's phonetic guide (OOXML <rPh>), or an empty string when the cell has no guide.
fm_workbook_get_cell_phonetic_run_countfm_status_t fm_workbook_get_cell_phonetic_run_count(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, uint32_t* out_count)Counts the <rPh> blocks attached to a cell.
fm_workbook_get_cell_phonetic_runfm_status_t fm_workbook_get_cell_phonetic_run(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, uint32_t run_index, fm_phonetic_run_t* out)Reads the run_index-th <rPh> block of a cell.
fm_workbook_get_cell_phonetic_propertiesfm_status_t fm_workbook_get_cell_phonetic_properties(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, uint32_t* out_font_id, uint32_t* out_type, uint32_t* out_alignment)Reads how a cell's phonetic guide renders (OOXML <phoneticPr>).
fm_workbook_has_cell_phonetic_propertiesfm_status_t fm_workbook_has_cell_phonetic_properties(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, int32_t* out_present)Reports whether the cell's <phoneticPr> triple is explicit.
fm_workbook_lambda_text_atfm_status_t fm_workbook_lambda_text_at(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char** out_text)Renders the lambda closure stored at (sheet_index, row, col) as Excel formula text.
fm_workbook_cell_countfm_status_t fm_workbook_cell_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Returns the number of written coordinates on sheet_index.
fm_workbook_cell_atfm_status_t fm_workbook_cell_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, uint32_t* out_row, uint32_t* out_col, const char** out_formula, fm_value_t* out_value)Reads the idx-th cell on sheet_index.
fm_workbook_get_formulafm_status_t fm_workbook_get_formula(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char** out_formula)Reads the formula of the cell at (row, col) in A1 notation.
fm_workbook_get_formula_r1c1fm_status_t fm_workbook_get_formula_r1c1(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char** out_formula)Reads the formula of the cell at (row, col) in R1C1 notation, relative to that cell.
fm_sheet_cells_in_rangefm_status_t fm_sheet_cells_in_range(const fm_workbook_t* wb, size_t sheet_index, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, uint64_t cursor, uint32_t limit, fm_cell_range_t** out)Enumerates the populated cells of an inclusive rectangle, one page at a time.
fm_cell_range_countfm_status_t fm_cell_range_count(const fm_cell_range_t* range, size_t* out_count)Number of cells in the page.
fm_cell_range_atfm_status_t fm_cell_range_at(const fm_cell_range_t* range, size_t idx, uint32_t* out_row, uint32_t* out_col, const char** out_formula, fm_value_t* out_value)Reads cell idx of the page.
fm_cell_range_next_cursorfm_status_t fm_cell_range_next_cursor(const fm_cell_range_t* range, uint64_t* out_cursor)Reads the cursor that resumes after this page, or UINT64_MAX when the rectangle holds no further populated cell.
fm_cell_range_destroyvoid fm_cell_range_destroy(fm_cell_range_t* range)Releases a page handle.

Recalculation ​

NameSignatureDescription
fm_workbook_recalcfm_status_t fm_workbook_recalc(fm_workbook_t* wb)Drives a full incremental recalc using the default function registry (eval::default_registry()).
fm_workbook_recalc_parallelfm_status_t fm_workbook_recalc_parallel(fm_workbook_t* wb, uint32_t thread_count, fm_parallel_recalc_stats* out_stats)Drives a full incremental recalc using the parallel SCC scheduler.
fm_workbook_set_iterativefm_status_t fm_workbook_set_iterative(fm_workbook_t* wb, int32_t enabled, int32_t max_iterations, double max_change)Configures iterative-calculation knobs for the workbook's recalc engine.
fm_workbook_set_iterative_enabledfm_status_t fm_workbook_set_iterative_enabled(fm_workbook_t* wb, int32_t enabled)Changes only whether iterative calculation is enabled.
fm_workbook_get_iterativefm_status_t fm_workbook_get_iterative(const fm_workbook_t* wb, int32_t* out_enabled, uint32_t* out_max_iterations, double* out_max_change)Reads the iterative-calculation settings currently stored on a workbook.
fm_workbook_calc_modefm_status_t fm_workbook_calc_mode(const fm_workbook_t* wb, fm_calc_mode_t* out_mode)Returns the workbook's calc mode.
fm_workbook_set_calc_modefm_status_t fm_workbook_set_calc_mode(fm_workbook_t* wb, int32_t mode)Sets the workbook's calc mode.
fm_workbook_full_precisionfm_status_t fm_workbook_full_precision(const fm_workbook_t* wb, int32_t* out)Reads <calcPr fullPrecision>: 1 for full precision (the default), 0 for "set precision as displayed".
fm_workbook_set_full_precisionfm_status_t fm_workbook_set_full_precision(fm_workbook_t* wb, int32_t full_precision)Sets <calcPr fullPrecision> (non-zero = full precision).
fm_workbook_calc_on_savefm_status_t fm_workbook_calc_on_save(const fm_workbook_t* wb, int32_t* out)Reads <calcPr calcOnSave> (default 1).
fm_workbook_set_calc_on_savefm_status_t fm_workbook_set_calc_on_save(fm_workbook_t* wb, int32_t calc_on_save)Sets <calcPr calcOnSave> (non-zero = recalculate before saving).
fm_workbook_ref_modefm_status_t fm_workbook_ref_mode(const fm_workbook_t* wb, fm_ref_mode_t* out)Reads <calcPr refMode> as an fm_ref_mode_t.
fm_workbook_set_ref_modefm_status_t fm_workbook_set_ref_mode(fm_workbook_t* wb, int32_t mode)Sets <calcPr refMode> from a raw fm_ref_mode_t ordinal.
fm_workbook_date1904fm_status_t fm_workbook_date1904(const fm_workbook_t* wb, int32_t* out)Reads the workbook's 1904 date system flag (<workbookPr date1904>).
fm_workbook_set_date1904fm_status_t fm_workbook_set_date1904(fm_workbook_t* wb, int32_t date1904)Sets the 1904 date system flag.
fm_workbook_pinned_nowfm_status_t fm_workbook_pinned_now(const fm_workbook_t* wb, fm_civil_time_t* out_now, int32_t* out_pinned)Reads the workbook's pinned wall-clock reading, if any.
fm_workbook_set_pinned_nowfm_status_t fm_workbook_set_pinned_now(fm_workbook_t* wb, const fm_civil_time_t* now)Pins every clock-dependent result in the workbook to one instant.
fm_workbook_clear_pinned_nowfm_status_t fm_workbook_clear_pinned_now(fm_workbook_t* wb)Releases the pin so clock-dependent results follow the host clock again.
fm_workbook_partial_recalcfm_status_t fm_workbook_partial_recalc(fm_workbook_t* wb, const fm_viewport* viewport, uint32_t* out_recomputed_count)Recalculates the dependency closure required to produce correct values for the supplied viewport rectangle.
fm_workbook_set_iterative_progressfm_status_t fm_workbook_set_iterative_progress(fm_workbook_t* wb, fm_iterative_progress_cb cb, void* user_data)Sets the iterative-solver progress callback for subsequent recalcs on this workbook.
fm_sheet_add_data_tablefm_status_t fm_sheet_add_data_table(fm_workbook_t* wb, size_t sheet_index, const fm_data_table* spec)Creates a data table over the result range of spec.
fm_sheet_data_table_atfm_status_t fm_sheet_data_table_at(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, int32_t* out_present, fm_data_table* out)Reads the data table whose result range contains (row, col).
fm_sheet_remove_data_tablefm_status_t fm_sheet_remove_data_table(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col)Removes the data table whose result range contains (row, col) and blanks its result cells.
fm_workbook_recalc_data_tablesfm_status_t fm_workbook_recalc_data_tables(fm_workbook_t* wb)Recomputes every data table now, whatever the calc mode.

Read-only evaluation ​

NameSignatureDescription
fm_workbook_evaluate_formulafm_status_t fm_workbook_evaluate_formula(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char* formula, fm_value_t* out)Evaluates formula as if entered at (row, col) on sheet_index, returning a single scalar result — WITHOUT mutating the workbook.
fm_workbook_evaluate_cf_formulafm_status_t fm_workbook_evaluate_cf_formula(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, uint32_t anchor_row, uint32_t anchor_col, const char* formula, fm_value_t* out)Evaluates formula as a conditional-formatting rule predicate anchored at (row, col), with relative references written relative to (anchor_row, anchor_col) (the CF-applied range's top-left) — WITHOUT mutating the workbook.
fm_workbook_evaluate_formula_arrayfm_status_t fm_workbook_evaluate_formula_array(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char* formula, uint32_t* out_rows, uint32_t* out_cols)Evaluates formula as if entered at (row, col) and stashes the WHOLE result — array included — on the handle, returning its dimensions.
fm_workbook_evaluate_formula_array_cellfm_status_t fm_workbook_evaluate_formula_array_cell(const fm_workbook_t* wb, size_t index, fm_value_t* out)Reads the row-major index-th cell of the most recent fm_workbook_evaluate_formula_array result into *out.

Profiles, locale and text ​

NameSignatureDescription
fm_workbook_excel_profile_idfm_status_t fm_workbook_excel_profile_id(const fm_workbook_t* wb, const char** out_profile_id)Returns the workbook's active Excel formula profile id.
fm_workbook_set_excel_profile_idfm_status_t fm_workbook_set_excel_profile_id(fm_workbook_t* wb, const char* profile_id)Sets the workbook's Excel formula profile by id.
fm_function_metadatafm_status_t fm_function_metadata(const char* name, fm_function_metadata_t* out)Returns metadata for the function name.
fm_function_countsize_t fm_function_count(void)Returns the total number of registered Formulon functions.
fm_function_name_atfm_status_t fm_function_name_at(size_t idx, const char** out_name)Returns the canonical name of the idx-th registered function.
fm_function_localizefm_status_t fm_function_localize(const char* canonical_name, const char* profile_id, const char** out_localized)Returns the localized display name for canonical_name under the profile profile_id, or canonical_name itself when the locale has no alias.
fm_function_canonicalizefm_status_t fm_function_canonicalize(const char* localized_name, const char* profile_id, const char** out_canonical)Returns the canonical (English UPPERCASE) name for the localized function localized_name under the profile profile_id.
fm_formula_localizefm_status_t fm_formula_localize(const char* formula, const char* profile_id, const char** out_formula)Rewrites stored (en-invariant) formula text into profile_id's spelling.
fm_formula_canonicalizefm_status_t fm_formula_canonicalize(const char* formula, const char* profile_id, const char** out_formula)Rewrites profile_id-spelled formula text into the en-invariant form; the inverse of fm_formula_localize.
fm_locale_factsfm_status_t fm_locale_facts(const char* profile_id, fm_locale_facts_t* out)Fills *out with the locale facts of profile_id.
fm_text_comparefm_status_t fm_text_compare(const char* a, const char* b, const char* profile_id, fm_collation_strength_t strength, int32_t* out_order)Compares two texts under profile_id's collation.
fm_collation_classesfm_status_t fm_collation_classes(const fm_value_t* values, size_t count, const char* profile_id, fm_collation_strength_t strength, uint32_t* out_class_ids, uint32_t* out_class_count)Classifies count values into equivalence classes.
fm_locale_error_name_countsize_t fm_locale_error_name_count(void)Returns the number of error values, the bound of error_index in fm_locale_error_name.
fm_locale_error_namefm_status_t fm_locale_error_name(const char* profile_id, size_t error_index, const char** out_canonical, const char** out_localized, int32_t* out_measured)Returns the canonical and the profile_id-localized spelling of the error at error_index.

Defined names ​

NameSignatureDescription
fm_workbook_set_defined_namefm_status_t fm_workbook_set_defined_name(fm_workbook_t* wb, const char* name, const char* formula)Sets (or appends, or removes) a workbook-scoped defined name.
fm_workbook_set_defined_name_scopedfm_status_t fm_workbook_set_defined_name_scoped(fm_workbook_t* wb, const char* name, const char* formula, int32_t local_sheet_id)Sets (or appends, or removes) a defined name in a specific scope.
fm_workbook_set_defined_name_attrsfm_status_t fm_workbook_set_defined_name_attrs(fm_workbook_t* wb, const char* name, int32_t local_sheet_id, const char* comment, int32_t hidden)Sets the comment and hidden attributes of an existing defined name.
fm_workbook_defined_name_countsize_t fm_workbook_defined_name_count(const fm_workbook_t* wb)Returns the number of defined names attached to the workbook.
fm_workbook_defined_name_atfm_status_t fm_workbook_defined_name_at(const fm_workbook_t* wb, size_t idx, const char** out_name, const char** out_formula, int32_t* out_local_sheet_id)Reads the idx-th defined name with its scope.
fm_workbook_defined_name_attrs_atfm_status_t fm_workbook_defined_name_attrs_at(const fm_workbook_t* wb, size_t idx, const char** out_comment, int32_t* out_hidden)Reads the comment and hidden attributes of the idx-th defined name (the entry fm_workbook_defined_name_at returns for idx).

Tables ​

NameSignatureDescription
fm_workbook_table_countsize_t fm_workbook_table_count(const fm_workbook_t* wb)Returns the number of tables attached to the workbook.
fm_workbook_table_atfm_status_t fm_workbook_table_at(const fm_workbook_t* wb, size_t idx, const char** out_name, const char** out_display_name, const char** out_ref, size_t* out_sheet_index)Reads the idx-th table's identifying metadata.
fm_workbook_table_createfm_status_t fm_workbook_table_create(fm_workbook_t* wb, size_t sheet_index, const char* ref, const char* name, const char* display_name, const char* const* column_names, size_t column_count, const char* style_name, int32_t header_row, int32_t totals_row, size_t* out_index)Creates a worksheet table (xl/tables/tableN.xml).
fm_workbook_table_updatefm_status_t fm_workbook_table_update(fm_workbook_t* wb, size_t index, const char* ref, const char* style_name, int32_t header_row, int32_t totals_row)Replaces a table's range and optional visual style.
fm_workbook_table_removefm_status_t fm_workbook_table_remove(fm_workbook_t* wb, size_t index)Removes the table at index.
fm_workbook_table_get_infofm_status_t fm_workbook_table_get_info(const fm_workbook_t* wb, size_t index, fm_table_info_t* out)Reads the style, row counts and column count of table index.
fm_workbook_table_get_columnfm_status_t fm_workbook_table_get_column(const fm_workbook_t* wb, size_t index, size_t column, fm_table_column_info_t* out)Reads column column (0-based, left to right) of table index.
fm_workbook_table_set_style_infofm_status_t fm_workbook_table_set_style_info(fm_workbook_t* wb, size_t index, const char* style_name, int32_t show_first_column, int32_t show_last_column, int32_t show_row_stripes, int32_t show_column_stripes)Sets the table's style name and toggles, making <tableStyleInfo> present.
fm_workbook_table_renamefm_status_t fm_workbook_table_rename(fm_workbook_t* wb, size_t index, const char* name, const char* display_name)Renames table index.
fm_workbook_table_set_column_totalsfm_status_t fm_workbook_table_set_column_totals(fm_workbook_t* wb, size_t index, size_t column, const char* function, const char* label, const char* formula)Sets column column's totals-row function and label.
fm_styles_get_table_style_countfm_status_t fm_styles_get_table_style_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of custom table / PivotTable styles.
fm_styles_get_table_stylefm_status_t fm_styles_get_table_style(fm_workbook_t* wb, uint32_t index, fm_table_style_t* out)Reads the index-th custom table style.
fm_styles_set_table_stylefm_status_t fm_styles_set_table_style(fm_workbook_t* wb, const fm_table_style_t* style)Adds a custom table style, or replaces the one with the same name (case-insensitive) in place.
fm_styles_remove_table_stylefm_status_t fm_styles_remove_table_style(fm_workbook_t* wb, const char* name)Removes the custom table style name (case-insensitive).
fm_styles_get_table_style_defaultsfm_status_t fm_styles_get_table_style_defaults(fm_workbook_t* wb, const char** out_table_style, const char** out_pivot_style)Reads the default table and PivotTable style names (model-backed views, empty when unset).
fm_styles_set_table_style_defaultsfm_status_t fm_styles_set_table_style_defaults(fm_workbook_t* wb, const char* table_style, const char* pivot_style)Sets the default table and PivotTable style names.

Dependencies, spills and external links ​

NameSignatureDescription
fm_workbook_precedentsfm_status_t fm_workbook_precedents(const fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, uint32_t depth, fm_cell_nodes_t** out)Returns the cells (sheet, row, col) directly reads (1-step precedents) when depth <= 1, or every cell reached within depth BFS steps when depth >= 2.
fm_workbook_dependentsfm_status_t fm_workbook_dependents(const fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, uint32_t depth, fm_cell_nodes_t** out)Returns the cells that read (sheet, row, col) directly (1-step dependents) when depth <= 1, or every cell reached within depth BFS steps in the reverse graph when depth >= 2.
fm_cell_nodes_destroyvoid fm_cell_nodes_destroy(fm_cell_nodes_t* nodes)Releases a trace results handle.
fm_cell_nodes_countsize_t fm_cell_nodes_count(const fm_cell_nodes_t* nodes)Returns the number of cells in the result.
fm_cell_nodes_atfm_status_t fm_cell_nodes_at(const fm_cell_nodes_t* nodes, size_t idx, fm_cell_node_t* out)Reads cell idx from the result.
fm_workbook_spill_infofm_status_t fm_workbook_spill_info(const fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, fm_spill_info_t* out)Returns the spill-region info for (sheet, row, col).
fm_workbook_external_link_countfm_status_t fm_workbook_external_link_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of external-link records carried by the workbook.
fm_workbook_external_link_atfm_status_t fm_workbook_external_link_at(fm_workbook_t* wb, uint32_t index, fm_external_link_record_t* out)Reads the index-th external-link record (1-based document order minus one — i.e. 0 is the first <externalReference>).

Sheet view and protection ​

NameSignatureDescription
fm_workbook_set_cell_show_phoneticfm_status_t fm_workbook_set_cell_show_phonetic(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, int32_t show)Sets the cell's "Show Phonetic" display flag (OOXML <c ph="1">, XLSB fPhShow).
fm_workbook_get_cell_show_phoneticfm_status_t fm_workbook_get_cell_show_phonetic(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, int32_t* out_show)Reads the cell's "Show Phonetic" flag into *out_show (0 or 1).
fm_workbook_get_protectionfm_status_t fm_workbook_get_protection(fm_workbook_t* wb, fm_workbook_protection_t* out)Reads the workbook's <workbookProtection>; every field is zero or empty when the workbook has none.
fm_workbook_set_protectionfm_status_t fm_workbook_set_protection(fm_workbook_t* wb, const fm_workbook_protection_t* protection)Replaces the modelled attributes of <workbookProtection>.
fm_sheet_protected_range_countfm_status_t fm_sheet_protected_range_count(fm_workbook_t* wb, uint32_t sheet, uint32_t* out_count)Number of protected ranges on sheet.
fm_sheet_get_protected_rangefm_status_t fm_sheet_get_protected_range(fm_workbook_t* wb, uint32_t sheet, uint32_t index, fm_protected_range_t* out)Reads protected range index in file order.
fm_sheet_add_protected_rangefm_status_t fm_sheet_add_protected_range(fm_workbook_t* wb, uint32_t sheet, const fm_protected_range_t* range)Appends a protected range.
fm_sheet_update_protected_rangefm_status_t fm_sheet_update_protected_range(fm_workbook_t* wb, uint32_t sheet, uint32_t index, const fm_protected_range_t* range)Replaces protected range index; the argument checks of fm_sheet_add_protected_range apply, with index also validated.
fm_sheet_remove_protected_rangefm_status_t fm_sheet_remove_protected_range(fm_workbook_t* wb, uint32_t sheet, uint32_t index)Removes protected range index.
fm_sheet_get_protectionfm_status_t fm_sheet_get_protection(const fm_workbook_t* wb, uint32_t sheet_index, fm_sheet_protection_t* out)Reads the sheet's protection state.
fm_sheet_set_protectionfm_status_t fm_sheet_set_protection(fm_workbook_t* wb, uint32_t sheet_index, const fm_sheet_protection_t* in)Sets the sheet's protection state.
fm_sheet_get_viewfm_status_t fm_sheet_get_view(const fm_workbook_t* wb, size_t sheet_index, fm_sheet_view_t* out)Reads the sheet-view state (zoom, frozen panes, tab hidden, and the display / orientation flags).
fm_sheet_set_top_leftfm_status_t fm_sheet_set_top_left(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col)Sets the sheet view's scroll origin (<sheetView topLeftCell>).
fm_sheet_set_pane_top_leftfm_status_t fm_sheet_set_pane_top_left(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col)Sets the first visible cell of a frozen or split view's lower-right pane (<pane topLeftCell>).
fm_sheet_set_splitfm_status_t fm_sheet_set_split(fm_workbook_t* wb, size_t sheet_index, double x_twips, double y_twips)Splits the sheet view at x_twips / y_twips (<pane xSplit ySplit> without a freeze state); 0 for no split on that axis.
fm_sheet_get_selectionfm_status_t fm_sheet_get_selection(const fm_workbook_t* wb, size_t sheet_index, uint32_t* out_active_row, uint32_t* out_active_col, fm_merge_range* out_ranges, size_t capacity, size_t* out_total)Reads the active pane's selection: the active cell and its ranges.
fm_sheet_set_selectionfm_status_t fm_sheet_set_selection(fm_workbook_t* wb, size_t sheet_index, uint32_t active_row, uint32_t active_col, const fm_merge_range* ranges, size_t count)Replaces the active pane's selection (<selection>): the active cell and the selected ranges (sqref).
fm_sheet_set_zoomfm_status_t fm_sheet_set_zoom(fm_workbook_t* wb, size_t sheet_index, uint32_t zoom_scale)Sets the sheet's zoom percentage.
fm_sheet_set_freezefm_status_t fm_sheet_set_freeze(fm_workbook_t* wb, size_t sheet_index, uint32_t freeze_rows, uint32_t freeze_cols)Sets the sheet's freeze pane in (rows, cols).
fm_sheet_set_tab_hiddenfm_status_t fm_sheet_set_tab_hidden(fm_workbook_t* wb, size_t sheet_index, int32_t hidden)Sets the sheet's tab-hidden flag.
fm_sheet_set_visibilityfm_status_t fm_sheet_set_visibility(fm_workbook_t* wb, size_t sheet_index, int32_t visibility)Sets the sheet's tab visibility to one of the three states.
fm_sheet_set_show_grid_linesfm_status_t fm_sheet_set_show_grid_lines(fm_workbook_t* wb, size_t sheet_index, int32_t show)Sets the sheet's gridline-visibility flag (showGridLines).
fm_sheet_set_show_row_col_headersfm_status_t fm_sheet_set_show_row_col_headers(fm_workbook_t* wb, size_t sheet_index, int32_t show)Sets the sheet's row/column header-visibility flag (showRowColHeaders).
fm_sheet_set_show_zerosfm_status_t fm_sheet_set_show_zeros(fm_workbook_t* wb, size_t sheet_index, int32_t show)Sets the sheet's zero-value display flag (showZeros).
fm_sheet_set_show_formulasfm_status_t fm_sheet_set_show_formulas(fm_workbook_t* wb, size_t sheet_index, int32_t show)Sets the sheet's formula-text display flag (showFormulas).
fm_sheet_set_show_outline_symbolsfm_status_t fm_sheet_set_show_outline_symbols(fm_workbook_t* wb, size_t sheet_index, int32_t show)Sets the sheet's outline-symbol display flag (showOutlineSymbols).
fm_sheet_set_right_to_leftfm_status_t fm_sheet_set_right_to_left(fm_workbook_t* wb, size_t sheet_index, int32_t right_to_left)Sets the sheet's right-to-left display flag (rightToLeft).
fm_sheet_set_tab_selectedfm_status_t fm_sheet_set_tab_selected(fm_workbook_t* wb, size_t sheet_index, int32_t selected)Sets the sheet's tab-selected flag (tabSelected).
fm_sheet_set_view_modefm_status_t fm_sheet_set_view_mode(fm_workbook_t* wb, size_t sheet_index, const char* mode)Sets the sheet's view mode (<sheetView view="...">).

Rows, columns and geometry ​

NameSignatureDescription
fm_sheet_get_column_countfm_status_t fm_sheet_get_column_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Returns the column-layout-override count for sheet_index.
fm_sheet_get_columnfm_status_t fm_sheet_get_column(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_column_layout_t* out)Reads the idx-th column-layout override.
fm_sheet_get_row_override_countfm_status_t fm_sheet_get_row_override_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Returns the row-layout-override count for sheet_index.
fm_sheet_get_row_overridefm_status_t fm_sheet_get_row_override(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_row_layout_t* out)Reads the idx-th row-layout override.
fm_sheet_set_column_widthfm_status_t fm_sheet_set_column_width(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last, double width)Sets or replaces the column width override for the inclusive column span [first, last].
fm_sheet_clear_column_widthfm_status_t fm_sheet_clear_column_width(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last)Removes the width override of the inclusive column span [first, last], returning those columns to the sheet default width.
fm_sheet_set_column_hiddenfm_status_t fm_sheet_set_column_hidden(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last, int32_t hidden)Sets or replaces the column hidden flag for the inclusive column span [first, last].
fm_sheet_set_column_outlinefm_status_t fm_sheet_set_column_outline(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last, uint8_t level)Sets or replaces the column outline level for the inclusive column span [first, last].
fm_sheet_set_column_collapsedfm_status_t fm_sheet_set_column_collapsed(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last, int32_t collapsed)Sets or clears the collapsed flag (the outline group summarised by the span is collapsed) for the inclusive column span [first, last].
fm_sheet_set_column_stylefm_status_t fm_sheet_set_column_style(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last, uint32_t xf_index)Sets or replaces the cell-style XF for the inclusive column span [first, last].
fm_sheet_clear_column_stylefm_status_t fm_sheet_clear_column_style(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last)Removes the cell-style XF from the inclusive column span [first, last].
fm_sheet_set_row_heightfm_status_t fm_sheet_set_row_height(fm_workbook_t* wb, size_t sheet_index, uint32_t row, double height)Sets or replaces the row height override for row.
fm_sheet_set_row_hiddenfm_status_t fm_sheet_set_row_hidden(fm_workbook_t* wb, size_t sheet_index, uint32_t row, int32_t hidden)Sets or replaces the row hidden flag for row.
fm_sheet_set_row_outlinefm_status_t fm_sheet_set_row_outline(fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint8_t level)Sets or replaces the row outline level for row.
fm_sheet_set_row_collapsedfm_status_t fm_sheet_set_row_collapsed(fm_workbook_t* wb, size_t sheet_index, uint32_t row, int32_t collapsed)Sets or clears the collapsed flag (the outline group summarised by the row is collapsed) for row.
fm_sheet_set_row_stylefm_status_t fm_sheet_set_row_style(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last, uint32_t xf_index)Sets or replaces the cell-style XF for the inclusive row span [first, last].
fm_sheet_clear_row_stylefm_status_t fm_sheet_clear_row_style(fm_workbook_t* wb, size_t sheet_index, uint32_t first, uint32_t last)Removes the cell-style XF from the inclusive row span [first, last].
fm_sheet_clear_row_heightfm_status_t fm_sheet_clear_row_height(fm_workbook_t* wb, size_t sheet_index, uint32_t row)Removes the height override of row, returning it to the sheet default height.
fm_sheet_get_format_defaultsfm_status_t fm_sheet_get_format_defaults(const fm_workbook_t* wb, size_t sheet_index, fm_sheet_format_defaults* out)Reads the sheet's default column / row metrics.
fm_sheet_set_format_defaultsfm_status_t fm_sheet_set_format_defaults(fm_workbook_t* wb, size_t sheet_index, const fm_sheet_format_defaults* defaults)Replaces the sheet's default column / row metrics.
fm_sheet_cell_rect_ptfm_status_t fm_sheet_cell_rect_pt(const fm_workbook_t* wb, size_t sheet_index, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, int32_t mode, fm_rect_pt* out)Reads the rectangle covering the inclusive cell range, in points from the top-left of cell A1.
fm_sheet_column_width_ptfm_status_t fm_sheet_column_width_pt(const fm_workbook_t* wb, size_t sheet_index, uint32_t col, int32_t mode, double* out_pt)Reads the effective width of column col in points; zero when the column is hidden.
fm_sheet_row_height_ptfm_status_t fm_sheet_row_height_pt(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, double* out_pt)Reads the effective height of row row in points; zero when the row is hidden.
fm_sheet_width_modelfm_status_t fm_sheet_width_model(const fm_workbook_t* wb, size_t sheet_index, int32_t mode, fm_width_model* out)Reads the column-width conversion model in mode.
fm_sheet_column_chars_to_ptfm_status_t fm_sheet_column_chars_to_pt(const fm_workbook_t* wb, size_t sheet_index, int32_t mode, double chars, double* out_pt)Converts a stored column width (character units with the column padding included, as <col width> holds it) to points.
fm_sheet_column_pt_to_charsfm_status_t fm_sheet_column_pt_to_chars(const fm_workbook_t* wb, size_t sheet_index, int32_t mode, double pt, double* out_chars)Inverse of fm_sheet_column_chars_to_pt: the stored width Excel writes for a column of pt, rounded to whole screen pixels; zero points maps to zero.

Display text ​

NameSignatureDescription
fm_workbook_get_display_textfm_status_t fm_workbook_get_display_text(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const char** out_text, int32_t* out_status)Reads the text Excel displays for the cell at (row, col).
fm_workbook_format_valuefm_status_t fm_workbook_format_value(const fm_workbook_t* wb, const fm_value_t* value, const char* format_code, const char** out_text, int32_t* out_status)Renders value under the stored-form number format format_code (General, [Red], ...), using the workbook's date system.

Styles ​

NameSignatureDescription
fm_sheet_range_style_basesfm_status_t fm_sheet_range_style_bases(const fm_workbook_t* wb, size_t sheet_index, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, uint32_t* out_xfs, size_t cap, size_t* out_len)Lists every cell-XF index some cell of the selection resolves to, ascending: the XFs of cells that carry their own, then the row, column or default (0) style of the rest.
fm_sheet_remap_range_stylefm_status_t fm_sheet_remap_range_style(fm_workbook_t* wb, size_t sheet_index, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, const uint32_t* from_xfs, const uint32_t* to_xfs, size_t count)Remaps the XFs of a selection: each cell ends at to_xfs[i] where it resolved to from_xfs[i] before; an unlisted XF is kept.
fm_sheet_snapshot_range_stylefm_status_t fm_sheet_snapshot_range_style(const fm_workbook_t* wb, size_t sheet_index, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, uint8_t** out_bytes, size_t* out_len)Captures the style state of a selection as an opaque, versioned byte string: the covered column styles (column selection), row styles (row selection), and every stored cell's XF and explicit-assignment mark.
fm_sheet_restore_range_stylefm_status_t fm_sheet_restore_range_style(fm_workbook_t* wb, size_t sheet_index, const uint8_t* bytes, size_t len)Puts a fm_sheet_snapshot_range_style capture back on sheet sheet_index.
fm_cell_get_xf_indexfm_status_t fm_cell_get_xf_index(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, uint32_t* out_xf_index)Reads the xf_index (style record id) attached to the cell at (row, col) on sheet.
fm_cell_set_xf_indexfm_status_t fm_cell_set_xf_index(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, uint32_t xf_index)Stores xf_index on the cell at (row, col) on sheet.
fm_cell_clear_xf_indexfm_status_t fm_cell_clear_xf_index(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col)Removes the direct style assignment from the cell at (row, col) on sheet, so a blank cell inherits its row / column style again.
fm_sheet_set_range_xf_indexfm_status_t fm_sheet_set_range_xf_index(fm_workbook_t* wb, uint32_t sheet, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, uint32_t xf_index)Stores xf_index on every cell in the inclusive rectangle [(first_row, first_col), (last_row, last_col)].
fm_styles_get_cell_xffm_status_t fm_styles_get_cell_xf(fm_workbook_t* wb, uint32_t xf_index, fm_cell_xf* out)Reads the xf_index-th <xf> record from the workbook's styles table, including optional alignment attributes and their presence flags.
fm_styles_get_fontfm_status_t fm_styles_get_font(fm_workbook_t* wb, uint32_t font_index, fm_font_record* out)Reads the font_index-th font record from the workbook's styles table.
fm_styles_get_num_fmt_stringfm_status_t fm_styles_get_num_fmt_string(fm_workbook_t* wb, uint16_t num_fmt_id, const char** out)Looks up the effective format string for num_fmt_id.
fm_styles_get_fillfm_status_t fm_styles_get_fill(fm_workbook_t* wb, uint32_t fill_index, fm_fill_record* out)Reads the fill_index-th fill record from the workbook's styles table.
fm_styles_get_borderfm_status_t fm_styles_get_border(fm_workbook_t* wb, uint32_t border_index, fm_border_record* out)Reads the border_index-th border record from the workbook's styles table.
fm_styles_get_dxf_countfm_status_t fm_styles_get_dxf_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of <dxf> differential-format records available for conditional-format dxfId resolution.
fm_styles_get_dxffm_status_t fm_styles_get_dxf(fm_workbook_t* wb, uint32_t dxf_index, fm_dxf_record* out)Reads the dxf_index-th differential-format record.
fm_styles_add_dxffm_status_t fm_styles_add_dxf(fm_workbook_t* wb, fm_dxf_record record, uint32_t* out_dxf_index)Adds a <dxf> differential-format record to the workbook's styles table, deduplicating against existing entries.
fm_styles_get_font_countfm_status_t fm_styles_get_font_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of font records currently registered in the workbook's styles table.
fm_styles_get_fill_countfm_status_t fm_styles_get_fill_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of fill records currently registered in the workbook's styles table.
fm_styles_get_border_countfm_status_t fm_styles_get_border_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of border records currently registered in the workbook's styles table.
fm_styles_get_cell_xf_countfm_status_t fm_styles_get_cell_xf_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of <xf> records currently registered in the workbook's styles table (i.e. the size of the cellXfs vector).
fm_styles_get_cell_style_countfm_status_t fm_styles_get_cell_style_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of named cell styles (<cellStyle> entries) registered in the workbook.
fm_styles_get_cell_stylefm_status_t fm_styles_get_cell_style(fm_workbook_t* wb, uint32_t index, fm_cell_style_record_t* out)Reads the index-th named cell style.
fm_styles_get_cell_style_xf_countfm_status_t fm_styles_get_cell_style_xf_count(fm_workbook_t* wb, uint32_t* out_count)Returns the number of <cellStyleXfs> records — the named- style xf table.
fm_styles_get_cell_style_xffm_status_t fm_styles_get_cell_style_xf(fm_workbook_t* wb, uint32_t index, fm_cell_xf* out)Reads the index-th <cellStyleXfs> record (named-style xf table).
fm_styles_add_fontfm_status_t fm_styles_add_font(fm_workbook_t* wb, fm_font_record record, uint32_t* out_index)Adds a font record to the workbook's styles table, deduplicating against existing entries.
fm_styles_set_fontfm_status_t fm_styles_set_font(fm_workbook_t* wb, uint32_t font_index, fm_font_record record)Overwrites the font_index-th font record in place.
fm_workbook_set_default_fontfm_status_t fm_workbook_set_default_font(fm_workbook_t* wb, fm_font_record record)Declares the workbook's default font.
fm_styles_add_fillfm_status_t fm_styles_add_fill(fm_workbook_t* wb, fm_fill_record record, uint32_t* out_index)Adds a fill record to the workbook's styles table, deduplicating against existing entries.
fm_styles_add_borderfm_status_t fm_styles_add_border(fm_workbook_t* wb, fm_border_record record, uint32_t* out_index)Adds a border record to the workbook's styles table, deduplicating against existing entries.
fm_styles_add_num_fmtfm_status_t fm_styles_add_num_fmt(fm_workbook_t* wb, const char* format_code, uint16_t* out_num_fmt_id)Adds a number-format code to the workbook's styles table, deduplicating against existing entries.
fm_styles_add_cell_xffm_status_t fm_styles_add_cell_xf(fm_workbook_t* wb, fm_cell_xf record, uint32_t* out_xf_index)Adds an <xf> record to the workbook's styles table, deduplicating against existing entries.
fm_styles_add_cell_style_xffm_status_t fm_styles_add_cell_style_xf(fm_workbook_t* wb, fm_cell_xf record, uint32_t* out_xf_id)Adds and deduplicates a named-style xf including optional alignment attributes.
fm_styles_set_cell_stylefm_status_t fm_styles_set_cell_style(fm_workbook_t* wb, const fm_cell_style_record_t* record)Adds or replaces the named <cellStyle> record record->name.
fm_styles_remove_cell_stylefm_status_t fm_styles_remove_cell_style(fm_workbook_t* wb, const char* name)Removes the named <cellStyle> record name.
fm_styles_add_batchfm_status_t fm_styles_add_batch(fm_workbook_t* wb, const fm_styles_batch* batch)Adds and deduplicates a batch of fonts, fills, borders, and cell xfs.
fm_sheet_get_effective_stylefm_status_t fm_sheet_get_effective_style(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, fm_effective_style* out)Reads the effective style of the cell at (row, col); see fm_effective_style.

Themes and colors ​

NameSignatureDescription
fm_workbook_get_theme_colorsfm_status_t fm_workbook_get_theme_colors(const fm_workbook_t* wb, fm_theme_colors* out, int32_t* out_source)Reads the theme's 12 scheme colours.
fm_workbook_set_theme_colorsfm_status_t fm_workbook_set_theme_colors(fm_workbook_t* wb, const fm_theme_colors* colors)Writes the theme's 12 scheme colours.
fm_workbook_get_theme_fontsfm_status_t fm_workbook_get_theme_fonts(const fm_workbook_t* wb, fm_theme_fonts* out)Reads the theme's major and minor typefaces.
fm_workbook_set_theme_fontsfm_status_t fm_workbook_set_theme_fonts(fm_workbook_t* wb, const fm_theme_fonts* fonts)Writes the theme's major and minor typefaces.
fm_workbook_theme_script_font_countfm_status_t fm_workbook_theme_script_font_count(const fm_workbook_t* wb, int32_t major, size_t* out_count)Counts the a:font script=... typeface=... entries of the theme's major (major nonzero) or minor (major == 0) font set.
fm_workbook_theme_script_font_atfm_status_t fm_workbook_theme_script_font_at(const fm_workbook_t* wb, int32_t major, size_t idx, const char** out_script, const char** out_typeface)Reads one script entry (in the theme part's file order) of the major or minor font set.
fm_workbook_set_theme_script_fontfm_status_t fm_workbook_set_theme_script_font(fm_workbook_t* wb, int32_t major, const char* script, const char* typeface)Sets the typeface of one script in the major (major nonzero) or minor font set.
fm_workbook_reset_themefm_status_t fm_workbook_reset_theme(fm_workbook_t* wb)Returns the workbook to the state of having no theme part, so fm_workbook_get_theme_colors reports source 1 and the default theme's colours and faces.
fm_workbook_resolve_colorfm_status_t fm_workbook_resolve_color(const fm_workbook_t* wb, fm_color_spec spec, int32_t context, uint32_t* out_argb, int32_t* out_resolution)Resolves a colour specification to the 0xAARRGGBB Excel renders.

Merges ​

NameSignatureDescription
fm_sheet_add_mergefm_status_t fm_sheet_add_merge(fm_workbook_t* wb, uint32_t sheet, fm_merge_range merge)Appends a merge range to the sheet's merge list.
fm_sheet_remove_mergefm_status_t fm_sheet_remove_merge(fm_workbook_t* wb, uint32_t sheet, fm_merge_range range)Removes every merge range on sheet that overlaps range (inclusive rectangle intersection).
fm_sheet_remove_merge_atfm_status_t fm_sheet_remove_merge_at(fm_workbook_t* wb, uint32_t sheet, uint32_t index)Removes the merge at index on sheet.
fm_sheet_clear_mergesfm_status_t fm_sheet_clear_merges(fm_workbook_t* wb, uint32_t sheet)Drops every merge range on sheet.
fm_sheet_get_merge_atfm_status_t fm_sheet_get_merge_at(fm_workbook_t* wb, uint32_t sheet, uint32_t index, fm_merge_range* out)Reads the index-th merge range on sheet.
fm_sheet_get_merge_countfm_status_t fm_sheet_get_merge_count(fm_workbook_t* wb, uint32_t sheet, uint32_t* out_count)Returns the number of merge ranges attached to sheet.
fm_sheet_merges_in_rangefm_status_t fm_sheet_merges_in_range(fm_workbook_t* wb, uint32_t sheet, fm_merge_range range, fm_merge_range* out, uint32_t capacity, uint32_t* out_count)Copies every merge range on sheet that intersects range into the caller's buffer, in storage order.
NameSignatureDescription
fm_sheet_add_hyperlinkfm_status_t fm_sheet_add_hyperlink(fm_workbook_t* wb, uint32_t sheet, fm_hyperlink hl)Appends a hyperlink covering the inclusive rectangle (hl.row, hl.col)..(hl.last_row, hl.last_col) to sheet.
fm_sheet_remove_hyperlinkfm_status_t fm_sheet_remove_hyperlink(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col)Removes every hyperlink anchored at the exact (row, col) cell on sheet.
fm_sheet_remove_hyperlink_atfm_status_t fm_sheet_remove_hyperlink_at(fm_workbook_t* wb, uint32_t sheet, uint32_t index)Removes the hyperlink at index on sheet.
fm_sheet_clear_hyperlinksfm_status_t fm_sheet_clear_hyperlinks(fm_workbook_t* wb, uint32_t sheet)Drops every hyperlink on sheet.
fm_sheet_get_comment_atfm_status_t fm_sheet_get_comment_at(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, fm_comment* out)Reads (out_row, out_col, out_author, out_text) for the comment at (row, col) on sheet.
fm_sheet_get_comment_countfm_status_t fm_sheet_get_comment_count(fm_workbook_t* wb, uint32_t sheet, uint32_t* out_count)Returns the number of comments attached to sheet, including comments anchored on cells that carry no value.
fm_sheet_get_comment_at_indexfm_status_t fm_sheet_get_comment_at_index(fm_workbook_t* wb, uint32_t sheet, uint32_t index, fm_comment* out)Reads the index-th comment on sheet into out, in storage order.
fm_sheet_get_hyperlink_atfm_status_t fm_sheet_get_hyperlink_at(fm_workbook_t* wb, uint32_t sheet, uint32_t index, fm_hyperlink* out)Reads the index-th hyperlink on sheet into out.
fm_sheet_get_hyperlink_countfm_status_t fm_sheet_get_hyperlink_count(fm_workbook_t* wb, uint32_t sheet, uint32_t* out_count)Returns the number of hyperlinks attached to sheet.
fm_sheet_set_commentfm_status_t fm_sheet_set_comment(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, const char* author, const char* text)Inserts or replaces the comment at (row, col) on sheet.
fm_sheet_get_comment_visiblefm_status_t fm_sheet_get_comment_visible(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, int32_t* out_visible)Reads whether the note at (row, col) is shown without hovering (visibility:visible in the note's VML shape).
fm_sheet_set_comment_visiblefm_status_t fm_sheet_set_comment_visible(fm_workbook_t* wb, uint32_t sheet, uint32_t row, uint32_t col, int32_t visible)Shows (visible != 0) or hides the note at (row, col).

Threaded comments and persons ​

NameSignatureDescription
fm_sheet_threaded_comment_countfm_status_t fm_sheet_threaded_comment_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Number of threaded comments on the sheet, replies included.
fm_sheet_threaded_comment_atfm_status_t fm_sheet_threaded_comment_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_threaded_comment* out)Reads comment idx of the sheet's flat list, in file order: each thread's opening comment followed by its replies.
fm_sheet_add_threaded_commentfm_status_t fm_sheet_add_threaded_comment(fm_workbook_t* wb, size_t sheet_index, const fm_threaded_comment* comment)Adds a threaded comment.
fm_sheet_edit_threaded_commentfm_status_t fm_sheet_edit_threaded_comment(fm_workbook_t* wb, size_t sheet_index, const char* id, const char* text, const fm_mention* mentions, uint32_t mention_count)Replaces the text and mentions of the comment with id.
fm_sheet_set_thread_resolvedfm_status_t fm_sheet_set_thread_resolved(fm_workbook_t* wb, size_t sheet_index, const char* thread_id, int32_t done)Sets the resolved state of the thread opened by thread_id.
fm_sheet_remove_threaded_commentfm_status_t fm_sheet_remove_threaded_comment(fm_workbook_t* wb, size_t sheet_index, const char* id)Removes the comment with id; removing an opening comment removes its whole thread.
fm_workbook_person_countfm_status_t fm_workbook_person_count(const fm_workbook_t* wb, size_t* out_count)Number of entries in the workbook's person list.
fm_workbook_person_atfm_status_t fm_workbook_person_at(const fm_workbook_t* wb, size_t idx, fm_person* out)Reads person idx, in file order.
fm_workbook_add_personfm_status_t fm_workbook_add_person(fm_workbook_t* wb, const fm_person* person)Appends a person to the workbook's person list.
fm_workbook_remove_personfm_status_t fm_workbook_remove_person(fm_workbook_t* wb, const char* id)Removes the person with id.

AutoFilter ​

NameSignatureDescription
fm_sheet_get_auto_filter_xmlfm_status_t fm_sheet_get_auto_filter_xml(const fm_workbook_t* wb, size_t sheet_index, const char** out_xml)Returns the complete worksheet-level <autoFilter> XML fragment.
fm_sheet_set_auto_filter_xmlfm_status_t fm_sheet_set_auto_filter_xml(fm_workbook_t* wb, size_t sheet_index, const char* xml)Replaces the worksheet-level <autoFilter> XML fragment.
fm_sheet_get_auto_filterfm_status_t fm_sheet_get_auto_filter(const fm_workbook_t* wb, size_t sheet_index, fm_auto_filter* out, int32_t* out_present)Reads the sheet AutoFilter.
fm_sheet_set_auto_filterfm_status_t fm_sheet_set_auto_filter(fm_workbook_t* wb, size_t sheet_index, const fm_auto_filter* filter)Replaces the sheet AutoFilter and maintains the sheet's hidden _xlnm._FilterDatabase name over its range.
fm_sheet_remove_auto_filterfm_status_t fm_sheet_remove_auto_filter(fm_workbook_t* wb, size_t sheet_index)Removes the sheet AutoFilter and its _xlnm._FilterDatabase name.
fm_sheet_apply_auto_filterfm_status_t fm_sheet_apply_auto_filter(fm_workbook_t* wb, size_t sheet_index)Evaluates the sheet AutoFilter and sets every body row's hidden flag to the negation of its match, as Excel's Reapply does; a matching row hidden by hand is shown again, and rows outside the body are untouched.
fm_sheet_clear_auto_filterfm_status_t fm_sheet_clear_auto_filter(fm_workbook_t* wb, size_t sheet_index)Drops every column criterion of the sheet AutoFilter and shows all of its body rows.
fm_sheet_evaluate_auto_filterfm_status_t fm_sheet_evaluate_auto_filter(const fm_workbook_t* wb, size_t sheet_index, uint8_t* out_match, size_t cap, size_t* out_len, uint32_t* out_first_row)Evaluates the sheet AutoFilter without changing the sheet.
fm_table_get_auto_filterfm_status_t fm_table_get_auto_filter(const fm_workbook_t* wb, size_t table_index, fm_auto_filter* out, int32_t* out_present)Table counterparts of the sheet AutoFilter entry points.
fm_table_set_auto_filterfm_status_t fm_table_set_auto_filter(fm_workbook_t* wb, size_t table_index, const fm_auto_filter* filter)Table counterparts of the sheet AutoFilter entry points.
fm_table_remove_auto_filterfm_status_t fm_table_remove_auto_filter(fm_workbook_t* wb, size_t table_index)Table counterparts of the sheet AutoFilter entry points.
fm_table_apply_auto_filterfm_status_t fm_table_apply_auto_filter(fm_workbook_t* wb, size_t table_index)Table counterparts of the sheet AutoFilter entry points.
fm_table_clear_auto_filterfm_status_t fm_table_clear_auto_filter(fm_workbook_t* wb, size_t table_index)Table counterparts of the sheet AutoFilter entry points.
fm_table_evaluate_auto_filterfm_status_t fm_table_evaluate_auto_filter(const fm_workbook_t* wb, size_t table_index, uint8_t* out_match, size_t cap, size_t* out_len, uint32_t* out_first_row)Table counterparts of the sheet AutoFilter entry points.

Data validation ​

NameSignatureDescription
fm_sheet_get_validation_countfm_status_t fm_sheet_get_validation_count(fm_workbook_t* wb, uint32_t sheet, uint32_t* out_count)Returns the number of data-validation rules attached to sheet.
fm_sheet_get_validation_atfm_status_t fm_sheet_get_validation_at(fm_workbook_t* wb, uint32_t sheet, uint32_t index, fm_data_validation* out)Reads the index-th data-validation rule on sheet into out.
fm_sheet_add_validationfm_status_t fm_sheet_add_validation(fm_workbook_t* wb, uint32_t sheet, fm_data_validation v)Appends a data-validation rule to the sheet's validation list.
fm_sheet_remove_validation_atfm_status_t fm_sheet_remove_validation_at(fm_workbook_t* wb, uint32_t sheet, uint32_t index)Removes the validation rule at index on sheet.
fm_sheet_clear_validationsfm_status_t fm_sheet_clear_validations(fm_workbook_t* wb, uint32_t sheet)Drops every validation rule on sheet.
fm_sheet_validate_valuefm_status_t fm_sheet_validate_value(const fm_workbook_t* wb, size_t sheet_index, uint32_t row, uint32_t col, const fm_value_t* proposed, fm_validation_outcome* out)Checks proposed against the data-validation rule covering (row, col), without storing it.
fm_sheet_list_invalid_cellsfm_status_t fm_sheet_list_invalid_cells(const fm_workbook_t* wb, size_t sheet_index, uint64_t cursor, uint32_t limit, fm_cell_range_t** out)Enumerates, one page at a time, the cells whose current value fails the data-validation rule that covers them.

Conditional formats ​

NameSignatureDescription
fm_workbook_cf_evaluate_rangefm_status_t fm_workbook_cf_evaluate_range(const fm_workbook_t* wb, size_t sheet_index, uint32_t first_row, uint32_t first_col, uint32_t last_row, uint32_t last_col, double today_serial, fm_cf_results_t** out)Evaluates every CF block on sheet_index against the cells in the inclusive range [(first_row, first_col), (last_row, last_col)].
fm_cf_results_destroyvoid fm_cf_results_destroy(fm_cf_results_t* results)Releases a results handle.
fm_cf_results_cell_countsize_t fm_cf_results_cell_count(const fm_cf_results_t* results)Returns the number of cells in the result that produced at least one match.
fm_cf_results_cell_atfm_status_t fm_cf_results_cell_at(const fm_cf_results_t* results, size_t cell_idx, uint32_t* out_row, uint32_t* out_col, size_t* out_match_count)Reads cell cell_idx's coordinates and match count.
fm_cf_results_match_atfm_status_t fm_cf_results_match_at(const fm_cf_results_t* results, size_t cell_idx, size_t match_idx, fm_cf_match_t* out)Reads match match_idx for cell cell_idx.
fm_sheet_cf_countfm_status_t fm_sheet_cf_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Returns the total number of CF rules on sheet_index.
fm_sheet_cf_get_atfm_status_t fm_sheet_cf_get_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_cf_rule_t* out)Reads the idx-th CF rule (in flattened order) into out.
fm_sheet_cf_add_rulefm_status_t fm_sheet_cf_add_rule(fm_workbook_t* wb, size_t sheet_index, fm_cf_rule_t rule, size_t* out_index)Appends a new single-rule <conditionalFormatting> block.
fm_sheet_cf_remove_atfm_status_t fm_sheet_cf_remove_at(fm_workbook_t* wb, size_t sheet_index, size_t idx)Removes the idx-th CF rule (flattened order).
fm_sheet_cf_clearfm_status_t fm_sheet_cf_clear(fm_workbook_t* wb, size_t sheet_index)Removes every CF block on sheet_index.

Images and drawings ​

NameSignatureDescription
fm_workbook_probe_imagefm_status_t fm_workbook_probe_image(const fm_workbook_t* wb, const uint8_t* bytes, size_t len, fm_image_info* out)Sniffs the format and pixel size of PNG, JPEG, GIF or BMP bytes from the header alone, without touching the workbook.
fm_sheet_drawing_object_countfm_status_t fm_sheet_drawing_object_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Number of anchored objects in the sheet's drawing; 0 for a sheet without a drawing.
fm_sheet_drawing_object_atfm_status_t fm_sheet_drawing_object_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_drawing_object* out)Reads object idx of the sheet's drawing, in document order.
fm_sheet_get_imagefm_status_t fm_sheet_get_image(const fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const uint8_t** out_bytes, size_t* out_len, fm_image_info* out_info)Returns the media bytes and header info of the picture object_id.
fm_sheet_insert_imagefm_status_t fm_sheet_insert_image(fm_workbook_t* wb, size_t sheet_index, const uint8_t* bytes, size_t len, const fm_image_insert* opts, uint32_t* out_object_id)Inserts bytes as a picture and returns its object id, unique within the sheet's drawing.
fm_sheet_remove_drawingfm_status_t fm_sheet_remove_drawing(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id)Removes the picture or chart object_id, the relationships it names, and the parts it reaches (media, or a chart part and its style, colors and embeddings) once nothing else references them.
fm_sheet_set_drawing_anchorfm_status_t fm_sheet_set_drawing_anchor(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const fm_drawing_anchor* anchor)Moves and resizes the picture or chart object_id (the first one when ids repeat), keeping its id, name, crop, rotation, flips and every other element.
fm_sheet_set_drawing_z_orderfm_status_t fm_sheet_set_drawing_z_order(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, uint32_t index)Moves the picture or chart object_id so it becomes item index of the drawing's object list (0 is the back).
fm_sheet_snapshot_drawingfm_status_t fm_sheet_snapshot_drawing(const fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, uint8_t** out_bytes, size_t* out_len)Captures the picture or chart object_id as an opaque, versioned byte string: its list position, its element, the relationships it names with their parts, and every part reachable from those parts' relationships (a chart's style, colors, user shapes, embeddings).
fm_sheet_restore_drawingfm_status_t fm_sheet_restore_drawing(fm_workbook_t* wb, size_t sheet_index, const uint8_t* bytes, size_t len, uint32_t flags, uint32_t* out_object_id)Puts a fm_sheet_snapshot_drawing capture (this version or an earlier one) into sheet sheet_index and returns the object's id.
fm_sheet_shape_countfm_status_t fm_sheet_shape_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Number of shapes, connectors and groups in the sheet's drawing; 0 for a sheet without a drawing.
fm_sheet_shape_atfm_status_t fm_sheet_shape_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_shape* out)Reads shape idx of the sheet's drawing, in z-order (0 is the back).
fm_sheet_insert_shapefm_status_t fm_sheet_insert_shape(fm_workbook_t* wb, size_t sheet_index, const fm_shape* spec, uint32_t* out_object_id)Appends a shape on top of the sheet's drawing and returns its id.
fm_sheet_update_shapefm_status_t fm_sheet_update_shape(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const fm_shape* spec)Applies the fields spec->fields names to the shape, connector or group object_id, keeping the rest of its XML.
fm_sheet_remove_shapefm_status_t fm_sheet_remove_shape(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id)Removes the shape, connector or group object_id with its children.
fm_sheet_slicer_countfm_status_t fm_sheet_slicer_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Number of table slicers hosted by the sheet; 0 for a sheet without any.
fm_sheet_slicer_atfm_status_t fm_sheet_slicer_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_slicer* out)Reads slicer idx of the sheet.
fm_sheet_add_slicerfm_status_t fm_sheet_add_slicer(fm_workbook_t* wb, size_t sheet_index, size_t table_index, size_t column_index, const fm_slicer* spec, uint32_t* out_object_id)Adds a slicer on the sheet over column column_index (0-based) of table table_index and returns its frame id.
fm_sheet_update_slicerfm_status_t fm_sheet_update_slicer(fm_workbook_t* wb, size_t sheet_index, size_t idx, const fm_slicer* spec)Applies the fields spec->fields names (all but the name) to slicer idx, keeping the rest of its XML.
fm_sheet_remove_slicerfm_status_t fm_sheet_remove_slicer(fm_workbook_t* wb, size_t sheet_index, size_t idx)Removes slicer idx with its drawing frame, and its cache when no other slicer uses it, and the sheet's drawing when it held nothing else.
fm_sheet_sparkline_group_countfm_status_t fm_sheet_sparkline_group_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Number of sparkline groups in the sheet's worksheet extension list.
fm_sheet_sparkline_group_atfm_status_t fm_sheet_sparkline_group_at(const fm_workbook_t* wb, size_t sheet_index, size_t idx, fm_sparkline_group* out)Reads sparkline group idx; date_axis_ref is a read-scratch-backed view.
fm_sheet_sparkline_atfm_status_t fm_sheet_sparkline_at(const fm_workbook_t* wb, size_t sheet_index, size_t group_idx, size_t idx, fm_sparkline* out)Reads sparkline idx of group group_idx; both strings are read-scratch-backed views.
fm_sheet_add_sparkline_groupfm_status_t fm_sheet_add_sparkline_group(fm_workbook_t* wb, size_t sheet_index, const fm_sparkline_group* group, const fm_sparkline* items, size_t count)Appends a sparkline group with count sparklines.
fm_sheet_update_sparkline_groupfm_status_t fm_sheet_update_sparkline_group(fm_workbook_t* wb, size_t sheet_index, size_t idx, const fm_sparkline_group* group)Rewrites the modelled attributes, colours and date-axis reference of group idx from group; its sparklines and every attribute or child outside the model are kept.
fm_sheet_set_sparkline_group_sparklinesfm_status_t fm_sheet_set_sparkline_group_sparklines(fm_workbook_t* wb, size_t sheet_index, size_t idx, const fm_sparkline* items, size_t count)Replaces the sparklines of group idx with count new ones.
fm_sheet_remove_sparkline_groupfm_status_t fm_sheet_remove_sparkline_group(fm_workbook_t* wb, size_t sheet_index, size_t idx)Removes sparkline group idx.

Charts ​

NameSignatureDescription
fm_sheet_chart_openfm_status_t fm_sheet_chart_open(const fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, fm_chart_t** out)Reads the chart object_id into an owned snapshot.
fm_chart_destroyvoid fm_chart_destroy(fm_chart_t* chart)Releases a chart handle.
fm_chart_infofm_status_t fm_chart_info(const fm_chart_t* chart, fm_chart_info_t* out)Reads the chart's top-level fields.
fm_chart_legend_hidden_atfm_status_t fm_chart_legend_hidden_at(const fm_chart_t* chart, size_t idx, uint32_t* out)Reads the c:idx of legend entry idx hidden from the legend (idx < legend_hidden_count).
fm_chart_hidden_category_atfm_status_t fm_chart_hidden_category_at(const fm_chart_t* chart, size_t idx, uint32_t* out)Reads the position of hidden category idx (idx < hidden_category_count).
fm_chart_plot_atfm_status_t fm_chart_plot_at(const fm_chart_t* chart, size_t plot, fm_chart_plot_t* out)Reads plot group plot (plot < plot_count).
fm_chart_plot_axis_id_atfm_status_t fm_chart_plot_axis_id_at(const fm_chart_t* chart, size_t plot, size_t idx, uint32_t* out)Reads axis id idx of plot group plot (idx < axis_id_count).
fm_chart_series_atfm_status_t fm_chart_series_at(const fm_chart_t* chart, size_t plot, size_t series, fm_chart_series_t* out)Reads series series of plot group plot, in document order (series < series_count).
fm_chart_series_literal_atfm_status_t fm_chart_series_literal_at(const fm_chart_t* chart, size_t plot, size_t series, int32_t role, size_t idx, fm_chart_literal_t* out)Reads literal point idx of input role (an fm_chart_role_t) of a series (idx < literal_count).
fm_chart_series_point_atfm_status_t fm_chart_series_point_at(const fm_chart_t* chart, size_t plot, size_t series, size_t idx, fm_chart_point_t* out)Reads formatted point idx of a series (idx < point_count).
fm_chart_axis_atfm_status_t fm_chart_axis_at(const fm_chart_t* chart, size_t idx, fm_chart_axis_t* out)Reads axis idx (idx < axis_count).
fm_sheet_chart_data_openfm_status_t fm_sheet_chart_data_open(const fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, fm_chart_data_t** out)Resolves the chart's series against the current cell values, by Excel's rules (hidden cells, blanks, errors, filters).
fm_sheet_chart_preview_openfm_status_t fm_sheet_chart_preview_open(const fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const fm_chart_preview_overrides* overrides, fm_chart_data_t** out)fm_sheet_chart_data_open for a copy of the chart with overrides applied; the workbook is not changed.
fm_chart_data_destroyvoid fm_chart_data_destroy(fm_chart_data_t* data)Releases a chart data handle.
fm_chart_data_infofm_status_t fm_chart_data_info(const fm_chart_data_t* data, fm_chart_data_info_t* out)Reads the data summary.
fm_chart_data_category_atfm_status_t fm_chart_data_category_at(const fm_chart_data_t* data, size_t idx, const char** out_label, double* out_value)Reads category label idx (idx < category_label_count) and, for numeric categories, its value (NaN otherwise).
fm_chart_data_category_level_sizefm_status_t fm_chart_data_category_level_size(const fm_chart_data_t* data, size_t level, size_t* out_count)Reads the label count of upper category level level (level < category_level_count, outermost first).
fm_chart_data_category_level_atfm_status_t fm_chart_data_category_level_at(const fm_chart_data_t* data, size_t level, size_t idx, const char** out_label)Reads label idx of upper category level level.
fm_chart_data_series_atfm_status_t fm_chart_data_series_at(const fm_chart_data_t* data, size_t series, fm_chart_data_series_t* out)Reads resolved series series (series < series_count).
fm_chart_data_series_pointsfm_status_t fm_chart_data_series_points(const fm_chart_data_t* data, size_t series, fm_chart_data_points_t* out)Returns the point arrays of series series.
fm_chart_data_range_atfm_status_t fm_chart_data_range_at(const fm_chart_data_t* data, size_t series, int32_t role, size_t idx, fm_chart_sheet_range_t* out)Reads resolved rectangle idx of input role (an fm_chart_role_t) of series series (idx < range_count[role]).
fm_chart_data_axis_title_atfm_status_t fm_chart_data_axis_title_at(const fm_chart_data_t* data, size_t idx, fm_chart_axis_title_text_t* out)Reads axis title idx (idx < axis_title_count).
fm_chart_data_unresolved_atfm_status_t fm_chart_data_unresolved_at(const fm_chart_data_t* data, size_t idx, fm_chart_unresolved_t* out)Reads unresolved input idx (idx < unresolved_count).
fm_sheet_insert_chartfm_status_t fm_sheet_insert_chart(fm_workbook_t* wb, size_t sheet_index, const fm_chart_insert* opts, uint32_t* out_object_id)Creates a chart from opts with filled caches and returns its object id.
fm_sheet_set_chart_typefm_status_t fm_sheet_set_chart_type(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, size_t plot, int32_t kind, int32_t grouping)Replaces plot group plot with kind (an fm_chart_insert_kind_t) and grouping (an fm_chart_grouping_t), keeping each series' references, idx, order and explicit colors.
fm_sheet_set_chart_titlefm_status_t fm_sheet_set_chart_title(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const fm_chart_title_t* title)Sets the chart title: NONE removes it, TEXT writes text, REF writes the reference formula, AUTO leaves the text to the viewer.
fm_sheet_set_chart_legendfm_status_t fm_sheet_set_chart_legend(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const fm_chart_legend_patch* legend)Sets the legend position, overlay and hidden entries.
fm_sheet_set_chart_axisfm_status_t fm_sheet_set_chart_axis(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, uint32_t axis_id, const fm_chart_axis_patch* patch)Patches axis axis_id.
fm_sheet_set_chart_displayfm_status_t fm_sheet_set_chart_display(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, int32_t blanks_as, int32_t plot_vis_only)Writes c:dispBlanksAs (an fm_chart_blanks_as_t) and c:plotVisOnly (an fm_chart_tri_t); ABSENT removes the element.
fm_sheet_set_chart_seriesfm_status_t fm_sheet_set_chart_series(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, size_t plot, uint32_t series_idx, const fm_chart_series_patch* patch)Patches the series with c:idx series_idx of plot group plot.
fm_sheet_set_chart_pointfm_status_t fm_sheet_set_chart_point(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, size_t plot, uint32_t series_idx, uint32_t point_idx, const fm_chart_point_patch* patch)Patches point point_idx of series series_idx; a patch that changes nothing removes the point's formatting.
fm_sheet_set_chart_plotfm_status_t fm_sheet_set_chart_plot(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, size_t plot, const fm_chart_plot_patch* patch)Patches plot group plot.
fm_sheet_set_chart_filterfm_status_t fm_sheet_set_chart_filter(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const uint32_t* hidden_series, size_t hidden_series_count, const uint32_t* hidden_categories, size_t hidden_category_count)Replaces the chart filter: the listed series (by c:idx) and categories (positions in the full category range) are hidden.
fm_sheet_add_chart_seriesfm_status_t fm_sheet_add_chart_series(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, size_t plot, const fm_chart_series_patch* patch, uint32_t* out_series_idx)Appends a series to plot group plot from patch (which must set values, or y for a scatter plot) and returns its c:idx.
fm_sheet_remove_chart_seriesfm_status_t fm_sheet_remove_chart_series(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, size_t plot, uint32_t series_idx)Removes the series with c:idx series_idx from plot group plot.
fm_sheet_set_chart_sourcefm_status_t fm_sheet_set_chart_source(fm_workbook_t* wb, size_t sheet_index, uint32_t object_id, const char* source, int32_t direction, int32_t header_row, int32_t header_column)Rebuilds every series from source by the insert splitting rules, keeping the chart kind and each series' formatting by idx, and clears the filter.

Print settings and pagination ​

NameSignatureDescription
fm_workbook_paginatefm_status_t fm_workbook_paginate(const fm_workbook_t* wb, size_t sheet_index, fm_pagination_t** out)Paginates one worksheet and returns an owned snapshot of its resolved print area, row/column breaks, and physical page count.
fm_pagination_destroyvoid fm_pagination_destroy(fm_pagination_t* pagination)Releases a pagination result.
fm_pagination_page_countuint32_t fm_pagination_page_count(const fm_pagination_t* pagination)Returns the total physical page count, or zero for NULL.
fm_pagination_print_area_countsize_t fm_pagination_print_area_count(const fm_pagination_t* pagination)Number of rectangles in the sheet's declared _xlnm.Print_Area, or zero for NULL.
fm_pagination_print_area_atfm_status_t fm_pagination_print_area_at(const fm_pagination_t* pagination, size_t index, fm_print_range_t* out)Copies a resolved print-area rectangle by index.
fm_pagination_horizontal_break_countsize_t fm_pagination_horizontal_break_count(const fm_pagination_t* pagination)Number of horizontal (row) page breaks, or zero for NULL.
fm_pagination_horizontal_break_atfm_status_t fm_pagination_horizontal_break_at(const fm_pagination_t* pagination, size_t index, uint32_t* out_row)Reads a 0-based row index that a horizontal break precedes.
fm_pagination_vertical_break_countsize_t fm_pagination_vertical_break_count(const fm_pagination_t* pagination)Number of vertical (column) page breaks, or zero for NULL.
fm_pagination_vertical_break_atfm_status_t fm_pagination_vertical_break_at(const fm_pagination_t* pagination, size_t index, uint32_t* out_col)Reads a 0-based column index that a vertical break precedes.
fm_pagination_paperfm_status_t fm_pagination_paper(const fm_pagination_t* pagination, fm_paper_info* out)Reads the paper size and orientation pagination laid out on.
fm_pagination_marginsfm_status_t fm_pagination_margins(const fm_pagination_t* pagination, fm_margins_pt* out)Reads the page margins in points.
fm_pagination_printablefm_status_t fm_pagination_printable(const fm_pagination_t* pagination, fm_rect_pt* out)Reads the cell-body rectangle before print-title reservation, in points from the page's top-left corner.
fm_pagination_scalefm_status_t fm_pagination_scale(const fm_pagination_t* pagination, double* out_scale)Reads the effective scale as a factor (1.0 is 100%): the scale percentage, or the fit-to-page factor.
fm_pagination_page_orderfm_status_t fm_pagination_page_order(const fm_pagination_t* pagination, int32_t* out_order)Reads the page order: 0 down-then-over (the OOXML default), 1 over-then-down.
fm_pagination_print_titlesfm_status_t fm_pagination_print_titles(const fm_pagination_t* pagination, fm_print_titles* out)Reads the print-title rows / columns repeated on every page.
fm_pagination_page_atfm_status_t fm_pagination_page_at(const fm_pagination_t* pagination, size_t index, fm_page_layout* out)Reads physical page index, in print order.
fm_pagination_horizontal_break_is_manualfm_status_t fm_pagination_horizontal_break_is_manual(const fm_pagination_t* pagination, size_t index, int32_t* out_manual)Reports whether horizontal break index (the domain of fm_pagination_horizontal_break_at) is a manual break (1) rather than one the page walk computed (0).
fm_pagination_vertical_break_is_manualfm_status_t fm_pagination_vertical_break_is_manual(const fm_pagination_t* pagination, size_t index, int32_t* out_manual)Vertical-break counterpart of fm_pagination_horizontal_break_is_manual.
fm_sheet_get_page_setup_xmlfm_status_t fm_sheet_get_page_setup_xml(const fm_workbook_t* wb, size_t sheet_index, const char** out_xml)Reads a worksheet print-settings element as raw XML.
fm_sheet_set_page_setup_xmlfm_status_t fm_sheet_set_page_setup_xml(fm_workbook_t* wb, size_t sheet_index, const char* xml)Replaces a worksheet print-settings element with raw XML.
fm_sheet_get_page_margins_xmlfm_status_t fm_sheet_get_page_margins_xml(const fm_workbook_t* wb, size_t sheet_index, const char** out_xml)Reads <pageMargins> as raw XML.
fm_sheet_set_page_margins_xmlfm_status_t fm_sheet_set_page_margins_xml(fm_workbook_t* wb, size_t sheet_index, const char* xml)Replaces <pageMargins>.
fm_sheet_get_print_options_xmlfm_status_t fm_sheet_get_print_options_xml(const fm_workbook_t* wb, size_t sheet_index, const char** out_xml)Reads <printOptions> as raw XML.
fm_sheet_set_print_options_xmlfm_status_t fm_sheet_set_print_options_xml(fm_workbook_t* wb, size_t sheet_index, const char* xml)Replaces <printOptions>.
fm_sheet_get_header_footer_xmlfm_status_t fm_sheet_get_header_footer_xml(const fm_workbook_t* wb, size_t sheet_index, const char** out_xml)Reads <headerFooter> as raw XML.
fm_sheet_set_header_footer_xmlfm_status_t fm_sheet_set_header_footer_xml(fm_workbook_t* wb, size_t sheet_index, const char* xml)Replaces <headerFooter>.
fm_sheet_get_sheet_pr_xmlfm_status_t fm_sheet_get_sheet_pr_xml(const fm_workbook_t* wb, size_t sheet_index, const char** out_xml)Reads <sheetPr> as raw XML.
fm_sheet_set_sheet_pr_xmlfm_status_t fm_sheet_set_sheet_pr_xml(fm_workbook_t* wb, size_t sheet_index, const char* xml)Replaces <sheetPr>.
fm_sheet_set_fit_to_pagefm_status_t fm_sheet_set_fit_to_page(fm_workbook_t* wb, size_t sheet_index, int32_t enabled)Sets or clears <sheetPr><pageSetUpPr fitToPage> without disturbing any other <sheetPr> content.
fm_sheet_set_print_areafm_status_t fm_sheet_set_print_area(fm_workbook_t* wb, size_t sheet_index, const char* ranges_a1)Writes the sheet-scoped _xlnm.Print_Area defined name.
fm_sheet_get_print_areafm_status_t fm_sheet_get_print_area(const fm_workbook_t* wb, size_t sheet_index, const char** out_ranges_a1)Reads the print area back as unqualified A1 ranges, or an empty string when the sheet declares none.
fm_sheet_set_print_titlesfm_status_t fm_sheet_set_print_titles(fm_workbook_t* wb, size_t sheet_index, const char* repeat_rows, const char* repeat_cols)Writes the sheet-scoped _xlnm.Print_Titles defined name.
fm_sheet_get_print_titlesfm_status_t fm_sheet_get_print_titles(const fm_workbook_t* wb, size_t sheet_index, const char** out_repeat_rows, const char** out_repeat_cols)Reads the repeat rows / columns back as "1:2" / "A:A", each an empty string when that axis is unset.
fm_sheet_add_row_breakfm_status_t fm_sheet_add_row_break(fm_workbook_t* wb, size_t sheet_index, uint32_t row, int32_t manual)Upserts a row break before row.
fm_sheet_add_col_breakfm_status_t fm_sheet_add_col_break(fm_workbook_t* wb, size_t sheet_index, uint32_t col, int32_t manual)Upserts a column break before col.
fm_sheet_remove_row_breakfm_status_t fm_sheet_remove_row_break(fm_workbook_t* wb, size_t sheet_index, uint32_t row)Removes the row break at row.
fm_sheet_remove_col_breakfm_status_t fm_sheet_remove_col_break(fm_workbook_t* wb, size_t sheet_index, uint32_t col)Removes the column break at col.
fm_sheet_clear_breaksfm_status_t fm_sheet_clear_breaks(fm_workbook_t* wb, size_t sheet_index)Removes every manual break on both axes.
fm_sheet_row_break_countsize_t fm_sheet_row_break_count(const fm_workbook_t* wb, size_t sheet_index)Number of row breaks declared on the sheet, or zero on any argument error.
fm_sheet_row_break_atfm_status_t fm_sheet_row_break_at(const fm_workbook_t* wb, size_t sheet_index, size_t index, fm_page_break_t* out)Copies the row break at index (ascending by row).
fm_sheet_col_break_countsize_t fm_sheet_col_break_count(const fm_workbook_t* wb, size_t sheet_index)Number of column breaks declared on the sheet, or zero on any argument error.
fm_sheet_col_break_atfm_status_t fm_sheet_col_break_at(const fm_workbook_t* wb, size_t sheet_index, size_t index, fm_page_break_t* out)Copies the column break at index (ascending by column).
fm_sheet_set_page_setupfm_status_t fm_sheet_set_page_setup(fm_workbook_t* wb, size_t sheet_index, const fm_page_setup_t* setup)Applies a partial <pageSetup> update.
fm_sheet_set_page_marginsfm_status_t fm_sheet_set_page_margins(fm_workbook_t* wb, size_t sheet_index, const fm_page_margins_t* margins)Applies a partial <pageMargins> update.
fm_sheet_set_print_optionsfm_status_t fm_sheet_set_print_options(fm_workbook_t* wb, size_t sheet_index, const fm_print_options_t* options)Applies a partial <printOptions> update.
fm_sheet_set_header_footerfm_status_t fm_sheet_set_header_footer(fm_workbook_t* wb, size_t sheet_index, const fm_header_footer_t* hf)Applies a partial <headerFooter> update.
fm_sheet_get_page_setupfm_status_t fm_sheet_get_page_setup(const fm_workbook_t* wb, size_t sheet_index, fm_page_setup_t* out)Reads the effective page setup.
fm_sheet_get_page_marginsfm_status_t fm_sheet_get_page_margins(const fm_workbook_t* wb, size_t sheet_index, fm_page_margins_t* out)Reads the effective page margins, in inches.

PivotTables ​

NameSignatureDescription
fm_workbook_pivot_countfm_status_t fm_workbook_pivot_count(const fm_workbook_t* wb, size_t sheet_index, size_t* out_count)Returns the number of pivot tables anchored on sheet_index.
fm_workbook_pivot_layoutfm_status_t fm_workbook_pivot_layout(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, fm_pivot_cells_t** out)Evaluates and projects the pivot_index-th PivotTable on a sheet.
fm_pivot_cells_destroyvoid fm_pivot_cells_destroy(fm_pivot_cells_t* cells)Releases a pivot layout handle.
fm_pivot_cells_countsize_t fm_pivot_cells_count(const fm_pivot_cells_t* cells)Returns the number of projected cells.
fm_pivot_cells_boundsfm_status_t fm_pivot_cells_bounds(const fm_pivot_cells_t* cells, uint32_t* out_top, uint32_t* out_left, uint32_t* out_rows, uint32_t* out_cols)Returns the projected layout bounds.
fm_pivot_cells_atfm_status_t fm_pivot_cells_at(const fm_pivot_cells_t* cells, size_t idx, fm_pivot_cell_t* out)Reads projected cell idx.
fm_workbook_pivot_createfm_status_t fm_workbook_pivot_create(fm_workbook_t* wb, size_t sheet_index, const char* utf8_name, uint32_t cache_id, uint32_t anchor_row, uint32_t anchor_col, size_t* out_pivot_index)Creates a new empty pivot table on sheet_index.
fm_workbook_pivot_removefm_status_t fm_workbook_pivot_remove(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index)Removes the pivot table at pivot_index from sheet_index.
fm_workbook_pivot_set_namefm_status_t fm_workbook_pivot_set_name(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const char* utf8_name)Renames the pivot table.
fm_workbook_pivot_set_anchorfm_status_t fm_workbook_pivot_set_anchor(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, uint32_t anchor_row, uint32_t anchor_col, uint32_t span_rows, uint32_t span_cols)Updates the pivot's anchor cell and span.
fm_workbook_pivot_set_grand_totalsfm_status_t fm_workbook_pivot_set_grand_totals(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, int32_t rows_enabled, int32_t cols_enabled)Toggles the row / column grand total bands on the pivot.
fm_workbook_pivot_set_style_infofm_status_t fm_workbook_pivot_set_style_info(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const char* utf8_style_name, int32_t show_row_headers, int32_t show_col_headers, int32_t show_row_stripes, int32_t show_col_stripes, int32_t show_last_column)Sets the pivot's table style and toggles, making the style element present.
fm_workbook_pivot_get_layoutfm_status_t fm_workbook_pivot_get_layout(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, fm_pivot_layout_t* out_layout)Reads the pivot's compact / tabular / outline report layout.
fm_workbook_pivot_set_layoutfm_status_t fm_workbook_pivot_set_layout(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, int32_t layout)Sets the pivot's compact / tabular / outline report layout.
fm_workbook_pivot_field_countfm_status_t fm_workbook_pivot_field_count(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t* out_count)Number of fields configured on the pivot.
fm_workbook_pivot_field_addfm_status_t fm_workbook_pivot_field_add(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const fm_pivot_field_spec_t* spec, size_t* out_field_idx)Places a field on the pivot.
fm_workbook_pivot_field_clearfm_status_t fm_workbook_pivot_field_clear(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index)Drops every field from the pivot, emptying the row and column field orders.
fm_workbook_pivot_field_set_axisfm_status_t fm_workbook_pivot_field_set_axis(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, int32_t axis)Sets the axis of pivot field field_idx.
fm_workbook_pivot_field_set_sortfm_status_t fm_workbook_pivot_field_set_sort(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, int32_t order, const char* by_field)Sets the sort directive on pivot field field_idx.
fm_workbook_pivot_field_set_subtotal_topfm_status_t fm_workbook_pivot_field_set_subtotal_top(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, int32_t top)Sets the subtotal_top flag on pivot field field_idx.
fm_workbook_pivot_field_add_itemfm_status_t fm_workbook_pivot_field_add_item(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, const char* utf8_name, int32_t visible)Appends a manual-filter item to pivot field field_idx, addressed by its label.
fm_workbook_pivot_field_add_item_atfm_status_t fm_workbook_pivot_field_add_item_at(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, uint32_t cache_index, int32_t visible)Appends a manual-filter item to pivot field field_idx, addressed by its position in the bound cache field's shared items.
fm_workbook_pivot_field_clear_itemsfm_status_t fm_workbook_pivot_field_clear_items(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx)Drops every manual-filter item from pivot field field_idx.
fm_workbook_pivot_field_set_item_visiblefm_status_t fm_workbook_pivot_field_set_item_visible(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, size_t item_idx, int32_t visible)Toggles the visibility of item item_idx on field field_idx.
fm_workbook_pivot_field_add_subtotal_fnfm_status_t fm_workbook_pivot_field_add_subtotal_fn(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, int32_t agg)Appends a subtotal-fn entry to pivot field field_idx.
fm_workbook_pivot_field_clear_subtotal_fnsfm_status_t fm_workbook_pivot_field_clear_subtotal_fns(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx)Drops every subtotal-fn entry from pivot field field_idx.
fm_workbook_pivot_field_set_date_groupfm_status_t fm_workbook_pivot_field_set_date_group(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, int32_t granularity, int32_t calendar, int32_t start_year_or_neg1, int32_t end_year_or_neg1, uint32_t interval_days, double start_serial_or_neg1, double end_serial_or_neg1)Configures date-grouping on pivot field field_idx.
fm_workbook_pivot_field_clear_date_groupfm_status_t fm_workbook_pivot_field_clear_date_group(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx)Removes the date-grouping config from pivot field field_idx.
fm_workbook_pivot_field_set_number_formatfm_status_t fm_workbook_pivot_field_set_number_format(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, const char* utf8)Sets the numFmtId of pivot field field_idx, as a decimal string naming a built-in id or one returned by fm_styles_add_num_fmt.
fm_workbook_pivot_set_row_field_orderfm_status_t fm_workbook_pivot_set_row_field_order(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const uint32_t* indices, size_t count)Replaces the row-axis field order with indices[0..count).
fm_workbook_pivot_set_col_field_orderfm_status_t fm_workbook_pivot_set_col_field_order(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const uint32_t* indices, size_t count)Replaces the column-axis field order.
fm_workbook_pivot_data_field_countfm_status_t fm_workbook_pivot_data_field_count(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t* out_count)Number of <dataField> entries on the pivot.
fm_workbook_pivot_data_field_addfm_status_t fm_workbook_pivot_data_field_add(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const fm_pivot_data_field_spec_t* spec, size_t* out_idx)Appends a new data-field entry.
fm_workbook_pivot_data_field_clearfm_status_t fm_workbook_pivot_data_field_clear(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index)Drops every data-field entry from the pivot.
fm_workbook_pivot_data_field_setfm_status_t fm_workbook_pivot_data_field_set(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t data_field_idx, const fm_pivot_data_field_spec_t* spec)Replaces the data-field entry at data_field_idx in place.
fm_workbook_pivot_get_cache_idfm_status_t fm_workbook_pivot_get_cache_id(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, uint32_t* out_cache_id)Reads the cache_id of the pivot cache the pivot draws from.
fm_workbook_pivot_get_namefm_status_t fm_workbook_pivot_get_name(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const char** out_name)Reads the pivot's name.
fm_workbook_pivot_get_grand_totalsfm_status_t fm_workbook_pivot_get_grand_totals(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, int32_t* out_rows, int32_t* out_cols)Reads the row / column grand total flags (0 or 1), the values fm_workbook_pivot_set_grand_totals writes.
fm_workbook_pivot_get_style_infofm_status_t fm_workbook_pivot_get_style_info(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, fm_pivot_style_info_t* out)Reads the pivot's table style into out, the values fm_workbook_pivot_set_style_info writes.
fm_workbook_pivot_field_atfm_status_t fm_workbook_pivot_field_at(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, fm_pivot_field_info_t* out)Reads the definition of pivot field field_idx into out.
fm_workbook_pivot_field_item_countfm_status_t fm_workbook_pivot_field_item_count(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, size_t* out_count)Number of items in pivot field field_idx's item list, the list fm_workbook_pivot_field_add_item / _add_item_at append to.
fm_workbook_pivot_field_item_atfm_status_t fm_workbook_pivot_field_item_at(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t field_idx, size_t item_idx, fm_pivot_item_info_t* out)Reads item item_idx of pivot field field_idx into out.
fm_workbook_pivot_data_field_atfm_status_t fm_workbook_pivot_data_field_at(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t data_field_idx, fm_pivot_data_field_spec_t* out)Reads data field data_field_idx into the shape fm_workbook_pivot_data_field_add accepts.
fm_workbook_pivot_get_row_field_orderfm_status_t fm_workbook_pivot_get_row_field_order(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const uint32_t** out_indices, size_t* out_count)Reads the row-axis field order: *out_indices points at *out_count indices into the pivot's fields, the list fm_workbook_pivot_set_row_field_order takes.
fm_workbook_pivot_get_col_field_orderfm_status_t fm_workbook_pivot_get_col_field_order(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const uint32_t** out_indices, size_t* out_count)Reads the column-axis field order.
fm_workbook_pivot_filter_countfm_status_t fm_workbook_pivot_filter_count(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t* out_count)Number of filters on the pivot; see the persistence contract above.
fm_workbook_pivot_filter_atfm_status_t fm_workbook_pivot_filter_at(const fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t filter_idx, fm_pivot_filter_spec_t* out)Reads the filter at filter_idx without mutating the pivot.
fm_workbook_pivot_filter_addfm_status_t fm_workbook_pivot_filter_add(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, const fm_pivot_filter_spec_t* spec)Appends an active filter.
fm_workbook_pivot_filter_clearfm_status_t fm_workbook_pivot_filter_clear(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index)Drops every listed filter from the pivot.
fm_workbook_pivot_filter_remove_atfm_status_t fm_workbook_pivot_filter_remove_at(fm_workbook_t* wb, size_t sheet_index, size_t pivot_index, size_t filter_idx)Removes the filter at filter_idx; see the persistence contract above.

Pivot caches ​

NameSignatureDescription
fm_workbook_pivot_cache_countfm_status_t fm_workbook_pivot_cache_count(const fm_workbook_t* wb, size_t* out_count)Returns the number of pivot caches owned by the workbook.
fm_workbook_pivot_cache_id_atfm_status_t fm_workbook_pivot_cache_id_at(const fm_workbook_t* wb, size_t idx, uint32_t* out_cache_id)Returns the cache_id of the pivot cache at flat index idx.
fm_workbook_pivot_cache_createfm_status_t fm_workbook_pivot_cache_create(fm_workbook_t* wb, uint32_t requested_id, uint32_t* out_cache_id)Creates a new empty pivot cache.
fm_workbook_pivot_cache_removefm_status_t fm_workbook_pivot_cache_remove(fm_workbook_t* wb, uint32_t cache_id)Removes the pivot cache with id cache_id.
fm_workbook_pivot_cache_get_worksheet_sourcefm_status_t fm_workbook_pivot_cache_get_worksheet_source(const fm_workbook_t* wb, uint32_t cache_id, int32_t* out_present, const char** out_ref, const char** out_sheet, const char** out_name)Reads the cache's worksheet source metadata.
fm_workbook_pivot_cache_set_worksheet_sourcefm_status_t fm_workbook_pivot_cache_set_worksheet_source(fm_workbook_t* wb, uint32_t cache_id, int32_t present, const char* ref, const char* sheet, const char* name)Sets or clears the cache's worksheet source metadata.
fm_workbook_pivot_cache_field_countfm_status_t fm_workbook_pivot_cache_field_count(const fm_workbook_t* wb, uint32_t cache_id, size_t* out_count)Number of fields on the cache identified by cache_id.
fm_workbook_pivot_cache_field_namefm_status_t fm_workbook_pivot_cache_field_name(const fm_workbook_t* wb, uint32_t cache_id, size_t field_idx, const char** out_utf8)Reads the name of the cache field at field_idx.
fm_workbook_pivot_cache_field_addfm_status_t fm_workbook_pivot_cache_field_add(fm_workbook_t* wb, uint32_t cache_id, const char* utf8_name, size_t* out_field_idx)Appends a new field with the given UTF-8 name to the cache.
fm_workbook_pivot_cache_field_clearfm_status_t fm_workbook_pivot_cache_field_clear(fm_workbook_t* wb, uint32_t cache_id)Drops every field (and every record) from the cache.
fm_workbook_pivot_cache_field_shared_item_countfm_status_t fm_workbook_pivot_cache_field_shared_item_count(const fm_workbook_t* wb, uint32_t cache_id, size_t field_idx, size_t* out_count)Number of shared items configured on cache field field_idx.
fm_workbook_pivot_cache_field_add_shared_item_numberfm_status_t fm_workbook_pivot_cache_field_add_shared_item_number(fm_workbook_t* wb, uint32_t cache_id, size_t field_idx, double value)Appends a numeric shared item to cache field field_idx.
fm_workbook_pivot_cache_field_add_shared_item_textfm_status_t fm_workbook_pivot_cache_field_add_shared_item_text(fm_workbook_t* wb, uint32_t cache_id, size_t field_idx, const char* utf8)Appends a text shared item to cache field field_idx.
fm_workbook_pivot_cache_field_add_shared_item_boolfm_status_t fm_workbook_pivot_cache_field_add_shared_item_bool(fm_workbook_t* wb, uint32_t cache_id, size_t field_idx, int32_t value)Appends a boolean shared item to cache field field_idx.
fm_workbook_pivot_cache_field_add_shared_item_blankfm_status_t fm_workbook_pivot_cache_field_add_shared_item_blank(fm_workbook_t* wb, uint32_t cache_id, size_t field_idx)Appends a blank shared item to cache field field_idx.
fm_workbook_pivot_cache_field_add_shared_item_errorfm_status_t fm_workbook_pivot_cache_field_add_shared_item_error(fm_workbook_t* wb, uint32_t cache_id, size_t field_idx, fm_error_code_t error)Appends an Excel error shared item to cache field field_idx.
fm_workbook_pivot_cache_field_clear_shared_itemsfm_status_t fm_workbook_pivot_cache_field_clear_shared_items(fm_workbook_t* wb, uint32_t cache_id, size_t field_idx)Drops every shared item from cache field field_idx.
fm_workbook_pivot_cache_record_countfm_status_t fm_workbook_pivot_cache_record_count(const fm_workbook_t* wb, uint32_t cache_id, size_t* out_count)Returns the number of records (rows) on the cache.
fm_workbook_pivot_cache_record_addfm_status_t fm_workbook_pivot_cache_record_add(fm_workbook_t* wb, uint32_t cache_id, size_t* out_record_idx)Appends a new empty record to the cache.
fm_workbook_pivot_cache_record_clearfm_status_t fm_workbook_pivot_cache_record_clear(fm_workbook_t* wb, uint32_t cache_id)Drops every record from the cache.
fm_workbook_pivot_cache_record_set_numberfm_status_t fm_workbook_pivot_cache_record_set_number(fm_workbook_t* wb, uint32_t cache_id, size_t record_idx, size_t field_idx, double value)Sets cell (record_idx, field_idx) to a numeric value.
fm_workbook_pivot_cache_record_set_textfm_status_t fm_workbook_pivot_cache_record_set_text(fm_workbook_t* wb, uint32_t cache_id, size_t record_idx, size_t field_idx, const char* utf8)Sets cell (record_idx, field_idx) to a UTF-8 text value.
fm_workbook_pivot_cache_record_set_boolfm_status_t fm_workbook_pivot_cache_record_set_bool(fm_workbook_t* wb, uint32_t cache_id, size_t record_idx, size_t field_idx, int32_t value)Sets cell (record_idx, field_idx) to a boolean value.
fm_workbook_pivot_cache_record_set_blankfm_status_t fm_workbook_pivot_cache_record_set_blank(fm_workbook_t* wb, uint32_t cache_id, size_t record_idx, size_t field_idx)Sets cell (record_idx, field_idx) to Blank.
fm_workbook_pivot_cache_record_set_errorfm_status_t fm_workbook_pivot_cache_record_set_error(fm_workbook_t* wb, uint32_t cache_id, size_t record_idx, size_t field_idx, fm_error_code_t error)Sets cell (record_idx, field_idx) to an Excel error value.

Where to go next ​