/** * Form Field Data API * * Extract and fill form field values in a document. */ import type { DocxDocument } from "../types.js"; /** Result of extracting form field values from a document. */ export interface FormFieldEntry { /** Field name (from ffData). */ readonly name: string; /** Field type. */ readonly type: "text" | "checkBox" | "dropDown"; /** Current value (text content for text fields, checked state for checkbox, selected index for dropdown). */ readonly value: string | boolean | number; /** For dropdown: the available entries. */ readonly entries?: readonly string[]; } /** * Extract all form field values from a document. * * Traverses the document body (paragraphs, tables, headers, footers) * and collects all legacy form field data. * * @param doc - The document to extract from. * @returns Array of form field entries with their current values. */ export declare function extractFormFields(doc: DocxDocument): FormFieldEntry[]; /** * Fill form field values throughout a document. * * The body, headers, footers, footnotes, endnotes and comments are all * processed so a form field placed inside a header (a common case) still * gets filled. Inside paragraphs the visitor descends into hyperlinks and * track-change wrappers so a form field referenced from a tracked * insertion is also reachable. * * @param doc - The document to fill (returns a new copy with filled values). * @param values - Map of field name → new value. * @returns A new document with form fields populated. */ export declare function fillFormFields(doc: DocxDocument, values: ReadonlyMap): DocxDocument;