From 29ed597df6464f760e3e2bccbcbe78a617ff6452 Mon Sep 17 00:00:00 2001 From: Wolfgang Faust Date: Fri, 12 May 2017 17:46:24 -0400 Subject: [PATCH] xlsx: Add properties of IWorkSheet. --- index.d.ts | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 145 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 3f3e45f..dec0b13 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for xlsx // Project: https://github.com/SheetJS/js-xlsx -// Definitions by: themauveavenger +// Definitions by: themauveavenger , Wolfgang Faust // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** Attempts to read filename and parse */ @@ -173,11 +173,154 @@ export interface IWorkBook { Props: IProperties; } +export interface IColInfo { + /** + * Excel's "Max Digit Width" unit, always integral + */ + MDW?: number; + /** + * width in Excel's "Max Digit Width", width*256 is integral + */ + width: number; + /** + * width in screen pixels + */ + wpx?: number; + /** + * intermediate character calculation + */ + wch?: number; + /** + * if true, the column is hidden + */ + hidden?: boolean; +} +export interface IRowInfo { + /** + * height in screen pixels + */ + hpx?: number; + /** + * height in points + */ + hpt?: number; + /** + * if true, the column is hidden + */ + hidden?: boolean; +} + +/** + * Write sheet protection properties. + */ +export interface IProtectInfo { + /** + * The password for formats that support password-protected sheets + * (XLSX/XLSB/XLS). The writer uses the XOR obfuscation method. + */ + password?: string; + /** + * Select locked cells + * @default: true + */ + selectLockedCells?: boolean; + /** + * Select unlocked cells + * @default: true + */ + selectUnlockedCells?: boolean; + /** + * Format cells + * @default: false + */ + formatCells?: boolean; + /** + * Format columns + * @default: false + */ + formatColumns?: boolean; + /** + * Format rows + * @default: false + */ + formatRows?: boolean; + /** + * Insert columns + * @default: false + */ + insertColumns?: boolean; + /** + * Insert rows + * @default: false + */ + insertRows?: boolean; + /** + * Insert hyperlinks + * @default: false + */ + insertHyperlinks?: boolean; + /** + * Delete columns + * @default: false + */ + deleteColumns?: boolean; + /** + * Delete rows + * @default: false + */ + deleteRows?: boolean; + /** + * Sort + * @default: false + */ + sort?: boolean; + /** + * Filter + * @default: false + */ + autoFilter?: boolean; + /** + * Use PivotTable reports + * @default: false + */ + pivotTables?: boolean; + /** + * Edit objects + * @default: true + */ + objects?: boolean; + /** + * Edit scenarios + * @default: true + */ + scenarios?: boolean; +} + +/** + * object representing any sheet (worksheet or chartsheet) + */ +export interface ISheet { + '!ref'?: string; + '!margins'?: { + left: number, + right: number, + top: number, + bottom: number, + header: number, + footer: number, + }; +} + /** * object representing the worksheet */ -export interface IWorkSheet { +export interface IWorkSheet extends ISheet { [cell: string]: IWorkSheetCell | any; + '!cols'?: IColInfo[]; + '!rows'?: IRowInfo[]; + '!merges'?: IRange[]; + '!protect'?: IProtectInfo; + '!autofilter'?: {ref: string}; } export interface IWorkSheetCell {