/** * Workbook package document properties (`docProps/core.xml` + `docProps/app.xml`). * * Public surface: {@link BuiltInDocumentProperties} via * `workbook.builtInDocumentProperties`, plus convenience `workbook.author` * (`dc:creator`). Member names follow XlsIO `IBuiltInDocumentProperties` * (camelCase); load/parse/serialize is this library's OOXML model — not a port * of XlsIO internals. * * Citations: * - ECMA-376-2 opc-coreProperties.xsd `CT_CoreProperties` * - ECMA-376-1 shared-documentPropertiesExtended.xsd `CT_Properties` * - MS-OE376 §2.1.1885–1888 — DocSecurity, HeadingPairs, TitlesOfParts * - CAPABILITY-MATRIX: package properties Read/Preserve * - Syncfusion XlsIO `IBuiltInDocumentProperties` (API names only) * * Custom properties (`docProps/custom.xml`) stay opaque package parts. * * Lossless policy: untouched loaded parts are not rewritten on save. Mutating a * core-backed field dirties core only; app-backed fields dirty app only. * Timestamps are never auto-stamped. Dirty app write emits Excel * inventory/defaults (HeadingPairs / TitlesOfParts / DocSecurity / …). * * @module */ import { OpcPackage } from '../core/package/opc-package'; import { OpcRelationship } from '../core/package/relationships'; /** * Host notifications for property mutation. * @private */ export interface DocumentPropertiesHost { markDirty(): void; } /** * Provides read and write access to a workbook's built-in metadata, such as * title, author, keywords, and the dates it was created and last saved. * * Assign `null` or `undefined` on setters to clear. Getters return `undefined` * when the field is absent. */ export interface BuiltInDocumentProperties { /** * The document's title (`dc:title`). * @private Not part of the shipped package surface (`stripInternal`). */ title: string | undefined | null; /** * The document's subject (`dc:subject`). * @private Not part of the shipped package surface (`stripInternal`). */ subject: string | undefined | null; /** The person who created the document. */ author: string | undefined | null; /** Search keywords for the document, separated by spaces. */ keywords: string | undefined | null; /** Descriptive notes about the document. */ comments: string | undefined | null; /** * The name of the template the document is based on (`Template`). * @private Not part of the shipped package surface (`stripInternal`). */ template: string | undefined | null; /** The person who last saved the document. */ lastAuthor: string | undefined | null; /** * The number of times the document has been saved (`cp:revision`). * @private Not part of the shipped package surface (`stripInternal`). */ revisionNumber: string | undefined | null; /** * The total time spent editing the document, in minutes. */ editTime: number | undefined | null; /** The date and time the document was last printed. */ lastPrinted: Date | undefined | null; /** The date and time the document was created. */ creationDate: Date | undefined | null; /** The date and time the document was last saved. */ lastSaveDate: Date | undefined | null; /** * App `Pages` inventory count. * @private Not part of the shipped package surface (`stripInternal`). */ pageCount: number | undefined | null; /** * App `Words`. * @private Not part of the shipped package surface (`stripInternal`). */ wordCount: number | undefined | null; /** * App `Characters`. * @private Not part of the shipped package surface (`stripInternal`). */ charCount: number | undefined | null; /** * Byte count. Not present in OOXML extended-properties schema; held in memory * only and is not written to `app.xml`. * @private Not part of the shipped package surface (`stripInternal`). */ byteCount: number | undefined | null; /** The name of the application that created the document. */ applicationName: string | undefined | null; /** The document's category. */ category: string | undefined | null; /** * The intended presentation format, such as "On-screen Show" (`PresentationFormat`). * @private Not part of the shipped package surface (`stripInternal`). */ presentationTarget: string | undefined | null; /** The total number of lines. */ lineCount: number | undefined | null; /** * App `Paragraphs` inventory count. * @private Not part of the shipped package surface (`stripInternal`). */ paragraphCount: number | undefined | null; /** * App `Slides` inventory count (presentation documents). * @private Not part of the shipped package surface (`stripInternal`). */ slideCount: number | undefined | null; /** * App `Notes` inventory count (presentation documents). * @private Not part of the shipped package surface (`stripInternal`). */ noteCount: number | undefined | null; /** * App `HiddenSlides` inventory count (presentation documents). * @private Not part of the shipped package surface (`stripInternal`). */ hiddenCount: number | undefined | null; /** The number of embedded sound and video clips. */ multimediaClipCount: number | undefined | null; /** The manager of the document's author. */ manager: string | undefined | null; /** The company that created the document. */ company: string | undefined | null; /** * Inverse of app `LinksUpToDate` (XlsIO `LinksDirty`). * `true` → write `LinksUpToDate=false`; `false` → `LinksUpToDate=true`. * @private Not part of the shipped package surface (`stripInternal`). */ linksDirty: boolean | undefined | null; /** The document's status, such as "Draft" or "Final". */ contentStatus: string | undefined | null; /** * The number of times the document has been saved. Alias of `revisionNumber`. * @private Not part of the shipped package surface (`stripInternal`). */ revision: string | undefined | null; /** * The document's version label (`dcterms:version` / core version). * @private Not part of the shipped package surface (`stripInternal`). */ version: string | undefined | null; /** The document's primary language. */ language: string | undefined | null; /** * A unique identifier for the document (`dc:identifier`). * @private Not part of the shipped package surface (`stripInternal`). */ identifier: string | undefined | null; /** The version of the creating application, such as "16.0000". */ appVersion: string | undefined | null; /** * The base address used to resolve relative hyperlinks (`HyperlinkBase`). * @private Not part of the shipped package surface (`stripInternal`). */ hyperlinkBase: string | undefined | null; /** Removes the value from every document property. */ clear(): void; } /** * Internal core + app package properties model and public façade implementation. * @private */ export declare class DocumentPropertiesImpl implements BuiltInDocumentProperties { private host; private _title; private _subject; private _author; private _keywords; private _comments; private _lastAuthor; private _category; private _contentStatus; private _revision; private _version; private _language; private _identifier; private _created; private _modified; private _lastPrinted; private _company; private _manager; private _application; private _appVersion; private _hyperlinkBase; private _template; private _editTime; private _pageCount; private _wordCount; private _charCount; private _byteCount; private _presentationTarget; private _lineCount; private _paragraphCount; private _slideCount; private _noteCount; private _hiddenCount; private _multimediaClipCount; /** Stored as wire LinksUpToDate; internal {@link linksDirty} exposes inverse. */ private _linksUpToDate; private corePartName; private appPartName; private coreDirty; private appDirty; /** Unknown / complex core children preserved as outer XML fragments. */ private coreExtraChildrenXml; /** Unknown / complex app children (HeadingPairs, TitlesOfParts, …). */ private appExtraChildrenXml; private coreRootExtraAttrsXml; private appRootExtraAttrsXml; /** True when keywords element had nested markup and was kept in extras. */ private keywordsPreservedRaw; private constructor(); /** Empty properties (create path). */ static empty(): DocumentPropertiesImpl; /** * Load core + app from package relationships or conventional part names. * Missing parts yield empty fields; custom.xml is ignored (opaque). */ static loadFromPackage(pkg: OpcPackage): DocumentPropertiesImpl; /** @private */ bindHost(host: DocumentPropertiesHost): void; /** @private */ readonly corePropertiesPartName: string | undefined; /** @private */ readonly extendedPropertiesPartName: string | undefined; /** @private — true when core.xml must be written. */ shouldWriteCore(): boolean; /** @private — true when app.xml must be written. */ shouldWriteApp(): boolean; /** * Serialize dirty parts into the package and ensure package-level relationships. * Untouched parts keep their original bytes (lossless open→save). * * When app is dirty, `options.sheetNames` drives Excel-compatible * `HeadingPairs` / `TitlesOfParts` (workbook order). * @private */ flush(pkg: OpcPackage, allocatePackageRelId: () => string, options?: DocumentPropertiesFlushOptions): void; /** @private */ /** @private */ title: string | undefined | null; /** @private */ /** @private */ subject: string | undefined | null; author: string | undefined | null; keywords: string | undefined | null; comments: string | undefined | null; lastAuthor: string | undefined | null; category: string | undefined | null; contentStatus: string | undefined | null; /** @private */ /** @private */ revision: string | undefined | null; /** @private */ /** @private */ version: string | undefined | null; language: string | undefined | null; /** @private */ /** @private */ identifier: string | undefined | null; lastPrinted: Date | undefined | null; company: string | undefined | null; manager: string | undefined | null; appVersion: string | undefined | null; /** @private */ /** @private */ hyperlinkBase: string | undefined | null; /** @private */ /** @private */ template: string | undefined | null; /** @private */ /** @private */ revisionNumber: string | undefined | null; editTime: number | undefined | null; creationDate: Date | undefined | null; lastSaveDate: Date | undefined | null; /** @private */ /** @private */ pageCount: number | undefined | null; /** @private */ /** @private */ wordCount: number | undefined | null; /** @private */ /** @private */ charCount: number | undefined | null; /** @private */ /** @private */ byteCount: number | undefined | null; applicationName: string | undefined | null; /** @private */ /** @private */ presentationTarget: string | undefined | null; lineCount: number | undefined | null; /** @private */ /** @private */ paragraphCount: number | undefined | null; /** @private */ /** @private */ slideCount: number | undefined | null; /** @private */ /** @private */ noteCount: number | undefined | null; /** @private */ /** @private */ hiddenCount: number | undefined | null; multimediaClipCount: number | undefined | null; /** @private */ /** @private */ linksDirty: boolean | undefined | null; /** * Clear all authorable built-in fields. Dirties core and app so both parts * rewrite (or omit empty fields) on the next save. */ clear(): void; /** @private */ applyCoreParsed(fields: CoreParsedFields): void; /** @private */ applyAppParsed(fields: AppParsedFields): void; /** @private — snapshot for serialize. */ coreSnapshot(): CoreParsedFields; /** @private */ appSnapshot(): AppParsedFields; private setCoreString; private setAppString; private setAppInt; private setCoreDate; private touchCore; private touchApp; } /** @private */ export interface CoreParsedFields { title: string | undefined; subject: string | undefined; author: string | undefined; keywords: string | undefined; comments: string | undefined; lastAuthor: string | undefined; category: string | undefined; contentStatus: string | undefined; revision: string | undefined; version: string | undefined; language: string | undefined; identifier: string | undefined; created: Date | undefined; modified: Date | undefined; lastPrinted: Date | undefined; extraChildrenXml: string[]; rootExtraAttrsXml: string; keywordsPreservedRaw: boolean; } /** @private */ export interface AppParsedFields { company: string | undefined; manager: string | undefined; application: string | undefined; appVersion: string | undefined; hyperlinkBase: string | undefined; template: string | undefined; editTime: number | undefined; pageCount: number | undefined; wordCount: number | undefined; charCount: number | undefined; presentationTarget: string | undefined; lineCount: number | undefined; paragraphCount: number | undefined; slideCount: number | undefined; noteCount: number | undefined; hiddenCount: number | undefined; multimediaClipCount: number | undefined; linksUpToDate: boolean | undefined; extraChildrenXml: string[]; rootExtraAttrsXml: string; } /** * Optional inventory passed when flushing a dirty extended-properties part. * @private */ export interface DocumentPropertiesFlushOptions { /** Worksheet names in workbook order for TitlesOfParts / HeadingPairs. */ readonly sheetNames?: ReadonlyArray; } /** * Package-root relative Target for an absolute part name (`/docProps/core.xml` → `docProps/core.xml`). * @private */ export declare function packageRelativeTarget(partName: string): string; /** * Highest numeric `rIdN` among package-level relationships (0 if none). * @private */ export declare function maxPackageRelationshipNumber(rels: ReadonlyArray): number;