Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/types/pivotTables/PivotFormat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Style } from '../styles/index.ts';
import type { integer } from '../integer.ts';
import type { PivotArea } from './PivotArea.ts';

/**
Expand All @@ -8,7 +8,7 @@ import type { PivotArea } from './PivotArea.ts';
* format targets with an action indicating whether formatting is applied or blanked.
*
* Formats are the durable representation of user formatting on pivot output: a consumer
* re-resolves each format's area against the current layout and overlays its {@link style} on
* re-resolves each format's area against the current layout and overlays its differential style on
* every repaint, so the formatting follows the targeted region (an item's data cells, the grand
* total row, ...) when the pivot reshapes, rather than sticking to cell coordinates.
*
Expand All @@ -24,9 +24,11 @@ export type PivotFormat = {
/** The pivot table region this format applies to. */
pivotArea: PivotArea;
/**
* The formatting to overlay on the area's cells. Only the properties present apply; everything
* else on a cell is left as-is (the differential-format semantics of OOXML's `dxf`).
* Absent for `action: 'blank'`.
* Index of the differential style to overlay on the area's cells, into
* {@link Workbook.diffStyles}. Only the properties present in that style apply; everything else
* on a cell is left as-is. Absent for `action: 'blank'`.
*
* @see {@link Workbook.diffStyles}
*/
style?: Style;
diffStyleId?: integer;
};
6 changes: 3 additions & 3 deletions src/types/pivotTables/PivotTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ export type PivotTable = {
/** Presentation style for the pivot table. */
style?: PivotTableStyle;
/**
* Custom formatting applied to specific regions of the pivot table. Each format carries its
* differential style inline (see {@link PivotFormat.style}); there is no separate dxf table
* in JSF.
* Custom formatting applied to specific regions of the pivot table. Each format references a
* shared differential style by index (see {@link PivotFormat.diffStyleId} and
* {@link Workbook.diffStyles}).
*/
formats?: PivotFormat[];
// conditionalFormats is omitted for now: the conditional formatting model is not finalized.
Expand Down
16 changes: 16 additions & 0 deletions src/types/workbooks/Workbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ export type Workbook = {
calculationProperties?: CalcProps;
/** Styles for cells in the workbook. */
styles?: Style[];
/**
* Differential styles: partial style overrides referenced by index from features that overlay
* formatting on top of a cell's own style rather than replacing it (pivot table formats, custom
* table styles, and future dynamic/conditional styles).
*
* This is the differential-overlay analog of {@link Workbook.styles}: where {@link Cell.s}
* indexes a complete cell style in `styles`, an overlay's `diffStyleId` indexes a partial
* override here. Only the properties present in an entry apply; everything else on the target
* cell is left as-is.
*
* Each entry reuses the {@link Style} type (already all-optional), but is interpreted
* differentially: an absent property means "leave unchanged", not "use the default".
*
* @see {@link PivotFormat.diffStyleId}
*/
diffStyles?: Style[];
/** Named cell style definitions (e.g. "Normal", "Heading 1"), keyed by style name. */
namedStyles?: Record<string, NamedStyle>;
/** External cells referenced by the workbook. An external cell is a cell in another workbook. */
Expand Down