@d0paminedriven/xlsxdown 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/browser.js +1 -0
- package/index.d.ts +465 -0
- package/index.js +786 -0
- package/package.json +116 -4
package/README.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @d0paminedriven/xlsxdown
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/DopamineDriven/assetdown/actions/workflows/xlsxdown-node.yml)
|
|
4
|
+
|
|
5
|
+
## Supported platforms
|
|
6
|
+
|
|
7
|
+
| Platform | Architecture(s) |
|
|
8
|
+
| ------------- | ----------------- |
|
|
9
|
+
| macOS | x64, ARM64 |
|
|
10
|
+
| Windows | x64, ia32, ARM64 |
|
|
11
|
+
| Linux (glibc) | x64, ARM64, ARMv7 |
|
|
12
|
+
| Linux (musl) | x64, ARM64 |
|
|
13
|
+
| FreeBSD | x64 |
|
|
14
|
+
| Android | ARM64, ARMv7 |
|
|
15
|
+
| WASI | wasm32 |
|
package/browser.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@d0paminedriven/xlsxdown-wasm32-wasi'
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
/* auto-generated by @d0paminedriven/xlsxdown */
|
|
2
|
+
/**
|
|
3
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
4
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
5
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
6
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
7
|
+
*/
|
|
8
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A parsed workbook. Parsing happens once, in the constructor or in `openAsync`; every method
|
|
12
|
+
* reads from the parsed workbook.
|
|
13
|
+
*/
|
|
14
|
+
export declare class XlsxDown {
|
|
15
|
+
/**
|
|
16
|
+
* Parse a workbook from the bytes of an `.xlsx` file. Throws `unsupported format: …` for a
|
|
17
|
+
* package that is not a plain workbook, `limit exceeded: …` for one past the size limits and
|
|
18
|
+
* `malformed workbook: …` for anything else that cannot be read.
|
|
19
|
+
*/
|
|
20
|
+
constructor(buffer: Buffer)
|
|
21
|
+
/**
|
|
22
|
+
* Parse a workbook off the JavaScript thread; resolves to an `XlsxDown`, or rejects with the
|
|
23
|
+
* errors the constructor throws.
|
|
24
|
+
*/
|
|
25
|
+
static openAsync(buffer: Buffer): Promise<XlsxDown>
|
|
26
|
+
/** The cells of the selected sheets, typed, with their display text, formulas and geometry. */
|
|
27
|
+
spreadsheetCells(opts?: SpreadsheetOptions | undefined | null): Array<SheetCells>
|
|
28
|
+
/** `spreadsheetCells` on a worker thread. */
|
|
29
|
+
spreadsheetCellsAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetCells>>
|
|
30
|
+
/**
|
|
31
|
+
* The cells of the selected sheets keyed by row and then column, so a cell, or a whole row,
|
|
32
|
+
* is one lookup: `rows["12"]["C"]`.
|
|
33
|
+
*/
|
|
34
|
+
spreadsheetGrid(opts?: SpreadsheetOptions | undefined | null): Array<SheetGrid>
|
|
35
|
+
/** `spreadsheetGrid` on a worker thread. */
|
|
36
|
+
spreadsheetGridAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetGrid>>
|
|
37
|
+
/**
|
|
38
|
+
* The selected sheets laid out as pages: each cell's text placed in its rectangle, broken
|
|
39
|
+
* into words and grouped into lines, every word naming its cell. Cells in hidden rows and
|
|
40
|
+
* columns are left off the page unless `hiddenCells` is set.
|
|
41
|
+
*/
|
|
42
|
+
layout(opts?: SpreadsheetOptions | undefined | null): Array<SheetPage>
|
|
43
|
+
/** `layout` on a worker thread. */
|
|
44
|
+
layoutAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetPage>>
|
|
45
|
+
/** Invoice fields read from the workbook's visible sheets, each laid out as a page. */
|
|
46
|
+
invoice(opts?: InvoiceOptions | undefined | null): InvoiceResult
|
|
47
|
+
/** `invoice` on a worker thread. */
|
|
48
|
+
invoiceAsync(opts?: InvoiceOptions | undefined | null): Promise<InvoiceResult>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** `value` is `lines` joined with `
|
|
52
|
+
`. */
|
|
53
|
+
export interface AddressField {
|
|
54
|
+
value: string
|
|
55
|
+
text: string
|
|
56
|
+
confidence: number
|
|
57
|
+
span?: FieldSpan
|
|
58
|
+
lines: Array<string>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An aircraft or engine the invoice relates to. Maintenance, parts and
|
|
63
|
+
* program invoices identify the asset by airframe (model, manufacturer serial
|
|
64
|
+
* number, registration) and/or by engine (model, engine serial number); one
|
|
65
|
+
* invoice can cover several assets, so `InvoiceFields.aircraft` is a list.
|
|
66
|
+
*/
|
|
67
|
+
export interface AircraftReference {
|
|
68
|
+
/** Airframe model, e.g. "Challenger 350", "Global 6000", "Phenom 300". */
|
|
69
|
+
model?: StringField
|
|
70
|
+
/** Manufacturer serial number (MSN). */
|
|
71
|
+
serialNumber?: StringField
|
|
72
|
+
/** Registration / tail number, e.g. "N123AB", "C-GXYZ". */
|
|
73
|
+
registration?: StringField
|
|
74
|
+
/** Engine model, e.g. "BR710", "AE 3007", "PW308C". */
|
|
75
|
+
engineModel?: StringField
|
|
76
|
+
/** Engine serial number (ESN). */
|
|
77
|
+
engineSerialNumber?: StringField
|
|
78
|
+
span?: FieldSpan
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A rectangle in the sheet frame: points, y up, with A1's top-left corner at `(0, height)`. */
|
|
82
|
+
export interface CellBox {
|
|
83
|
+
x0: number
|
|
84
|
+
y0: number
|
|
85
|
+
x1: number
|
|
86
|
+
y1: number
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Which tier named the currency: evidence on the page (an ISO code or an unambiguous glyph),
|
|
91
|
+
* content priors such as the vendor's country, the caller's option, or nothing.
|
|
92
|
+
*/
|
|
93
|
+
export type CurrencySource = 'Page' | 'Content' | 'Option' | 'Unknown'
|
|
94
|
+
|
|
95
|
+
/** `value` is an ISO 8601 calendar date, `YYYY-MM-DD`. */
|
|
96
|
+
export interface DateField {
|
|
97
|
+
value: string
|
|
98
|
+
text: string
|
|
99
|
+
confidence: number
|
|
100
|
+
span?: FieldSpan
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type DateOrder = 'Auto' | 'MDY' | 'DMY' | 'YMD'
|
|
104
|
+
|
|
105
|
+
export type EInvoiceStandard = 'FacturX' | 'ZUGFeRD' | 'XRechnung' | 'UBL' | 'Unknown'
|
|
106
|
+
|
|
107
|
+
export interface EmbeddedInvoiceXml {
|
|
108
|
+
filename: string
|
|
109
|
+
standard: EInvoiceStandard
|
|
110
|
+
/**
|
|
111
|
+
* The guideline / customization identifier, e.g.
|
|
112
|
+
* `urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic`.
|
|
113
|
+
*/
|
|
114
|
+
profile?: string
|
|
115
|
+
xml: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Where a field was read from, in PDF user space on a 1-based page. */
|
|
119
|
+
export interface FieldSpan {
|
|
120
|
+
page: number
|
|
121
|
+
x0: number
|
|
122
|
+
y0: number
|
|
123
|
+
x1: number
|
|
124
|
+
y1: number
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type InvoiceDocumentType = 'Invoice' | 'CreditNote' | 'Unknown'
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Field names mirror the de-facto vocabulary of common invoice extractors so
|
|
131
|
+
* consumers can swap sources with a thin mapper. Naming only: nothing here
|
|
132
|
+
* talks to any service.
|
|
133
|
+
*/
|
|
134
|
+
export interface InvoiceFields {
|
|
135
|
+
vendorName?: StringField
|
|
136
|
+
vendorAddress?: AddressField
|
|
137
|
+
vendorTaxId?: StringField
|
|
138
|
+
vendorEmail?: StringField
|
|
139
|
+
vendorPhone?: StringField
|
|
140
|
+
vendorWebsite?: StringField
|
|
141
|
+
customerName?: StringField
|
|
142
|
+
customerId?: StringField
|
|
143
|
+
customerAddress?: AddressField
|
|
144
|
+
customerTaxId?: StringField
|
|
145
|
+
billingAddress?: AddressField
|
|
146
|
+
shippingAddress?: AddressField
|
|
147
|
+
remittanceAddress?: AddressField
|
|
148
|
+
invoiceId?: StringField
|
|
149
|
+
invoiceDate?: DateField
|
|
150
|
+
dueDate?: DateField
|
|
151
|
+
purchaseOrder?: StringField
|
|
152
|
+
paymentTerm?: StringField
|
|
153
|
+
serviceStartDate?: DateField
|
|
154
|
+
serviceEndDate?: DateField
|
|
155
|
+
currencyCode?: string
|
|
156
|
+
subTotal?: MoneyField
|
|
157
|
+
totalDiscount?: MoneyField
|
|
158
|
+
totalTax?: MoneyField
|
|
159
|
+
shippingCost?: MoneyField
|
|
160
|
+
invoiceTotal?: MoneyField
|
|
161
|
+
amountDue?: MoneyField
|
|
162
|
+
previousUnpaidBalance?: MoneyField
|
|
163
|
+
/** MRO work order / shop order the invoice bills against. */
|
|
164
|
+
workOrder?: StringField
|
|
165
|
+
/** Aircraft and engines the invoice relates to; empty when none is identified. */
|
|
166
|
+
aircraft: Array<AircraftReference>
|
|
167
|
+
taxDetails: Array<TaxDetail>
|
|
168
|
+
paymentDetails: Array<PaymentDetail>
|
|
169
|
+
items: Array<InvoiceItem>
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface InvoiceItem {
|
|
173
|
+
description?: StringField
|
|
174
|
+
productCode?: StringField
|
|
175
|
+
quantity?: NumberField
|
|
176
|
+
unit?: StringField
|
|
177
|
+
unitPrice?: MoneyField
|
|
178
|
+
taxRate?: NumberField
|
|
179
|
+
tax?: MoneyField
|
|
180
|
+
discount?: MoneyField
|
|
181
|
+
date?: DateField
|
|
182
|
+
amount?: MoneyField
|
|
183
|
+
/** Absent when the item came from embedded XML (no page geometry). */
|
|
184
|
+
span?: FieldSpan
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Options accepted by every invoice entry point. `preferEmbeddedXml` picks the embedded
|
|
189
|
+
* XML over the pages when both exist; `languages`, `currency`, `dateOrder` and
|
|
190
|
+
* `decimalSeparator` steer the page reader where the page leaves a choice;
|
|
191
|
+
* `includeCandidates` lists, in `warnings`, the candidates each field was chosen from;
|
|
192
|
+
* `includeLayout` is reserved.
|
|
193
|
+
*/
|
|
194
|
+
export interface InvoiceOptions {
|
|
195
|
+
/** Label lexicons to enable; default `["en"]`. */
|
|
196
|
+
languages?: Array<string>
|
|
197
|
+
/** ISO 4217 hint when the page shows only symbols. */
|
|
198
|
+
currency?: string
|
|
199
|
+
dateOrder?: DateOrder
|
|
200
|
+
decimalSeparator?: "Auto" | "." | ","
|
|
201
|
+
/** Default `true`. Embedded Factur-X / ZUGFeRD / XRechnung / UBL XML is used when present. */
|
|
202
|
+
preferEmbeddedXml?: boolean
|
|
203
|
+
/** Reserved; accepted and ignored. */
|
|
204
|
+
includeLayout?: boolean
|
|
205
|
+
/**
|
|
206
|
+
* Default `false`. Lists, in `warnings`, the candidates each field was chosen from, with
|
|
207
|
+
* their scores.
|
|
208
|
+
*/
|
|
209
|
+
includeCandidates?: boolean
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface InvoiceResult {
|
|
213
|
+
source: InvoiceSource
|
|
214
|
+
documentType: InvoiceDocumentType
|
|
215
|
+
/** Document-level confidence, 0..1. */
|
|
216
|
+
confidence: number
|
|
217
|
+
fields: InvoiceFields
|
|
218
|
+
warnings: Array<string>
|
|
219
|
+
embeddedXml?: EmbeddedInvoiceXml
|
|
220
|
+
/** Which tier named `fields.currencyCode`; absent when no layout pass ran. */
|
|
221
|
+
currencySource?: CurrencySource
|
|
222
|
+
/** The evidence behind `documentType: CreditNote`; empty otherwise. */
|
|
223
|
+
creditSignals: Array<string>
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Which extraction path produced the result: embedded XML, the page text (native, OCR,
|
|
228
|
+
* rendered or mixed), or `None` when the document had no readable
|
|
229
|
+
* pages and no embedded XML.
|
|
230
|
+
*/
|
|
231
|
+
export type InvoiceSource = 'EmbeddedXml' | 'Native' | 'Ocr' | 'Rendered' | 'Mixed' | 'None'
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Money as a JS number plus the exact printed text; `text` is authoritative
|
|
235
|
+
* when cents matter.
|
|
236
|
+
*/
|
|
237
|
+
export interface MoneyField {
|
|
238
|
+
value: number
|
|
239
|
+
text: string
|
|
240
|
+
confidence: number
|
|
241
|
+
span?: FieldSpan
|
|
242
|
+
currencyCode?: string
|
|
243
|
+
currencySymbol?: string
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface NumberField {
|
|
247
|
+
value: number
|
|
248
|
+
text: string
|
|
249
|
+
confidence: number
|
|
250
|
+
span?: FieldSpan
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Whether a Number cell's value is a whole number JavaScript can hold exactly, or a fraction.
|
|
255
|
+
* A percentage is a fraction (50% is 0.5); the subtype is about the value, not the format.
|
|
256
|
+
*/
|
|
257
|
+
export type NumberSubtype = 'Integer' | 'Float'
|
|
258
|
+
|
|
259
|
+
export interface PaymentDetail {
|
|
260
|
+
iban?: StringField
|
|
261
|
+
swift?: StringField
|
|
262
|
+
bankName?: StringField
|
|
263
|
+
accountNumber?: StringField
|
|
264
|
+
routingNumber?: StringField
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* One cell of a worksheet: a discriminated union on `type` whose typed value is `value`
|
|
269
|
+
* (none for `Blank`). A Number carries the full double plus its `subtype` and the
|
|
270
|
+
* `currencySymbol` its format names. A Date carries an ISO date (`YYYY-MM-DD`) or date-time
|
|
271
|
+
* (`YYYY-MM-DDTHH:MM:SS`) and a Time a clock (`HH:MM:SS`), all 24-hour and with no time
|
|
272
|
+
* zone, because a workbook records none.
|
|
273
|
+
*
|
|
274
|
+
* `text` is the display text and `raw` the stored spelling (the serial for dates and
|
|
275
|
+
* times). `format` is the cell's number-format code; `formatSupported` says whether `text`
|
|
276
|
+
* was rendered from it, and when false `text` is the stored spelling.
|
|
277
|
+
*
|
|
278
|
+
* `formula` is the cell's formula without the leading `=`. On a cell that follows a shared
|
|
279
|
+
* formula it is the master's formula with its relative references moved to this cell, and
|
|
280
|
+
* `sharedFormula` names the master. `cached` says whether a result was stored.
|
|
281
|
+
*
|
|
282
|
+
* `merge` is the range this cell anchors, `hidden` whether its row or column is hidden, and
|
|
283
|
+
* `box` its rectangle in the sheet frame (a merged anchor spans its range).
|
|
284
|
+
*/
|
|
285
|
+
export type SheetCell =
|
|
286
|
+
| { type: 'Text'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox; value: string }
|
|
287
|
+
| { type: 'Number'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox; value: number; subtype: NumberSubtype; currencySymbol?: string }
|
|
288
|
+
| { type: 'Boolean'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox; value: boolean }
|
|
289
|
+
| { type: 'Error'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox; value: string }
|
|
290
|
+
| { type: 'Date'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox; value: string }
|
|
291
|
+
| { type: 'Time'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox; value: string }
|
|
292
|
+
| { type: 'Blank'; ref: string; row: number; col: number; text: string; raw: string; format?: string; formatSupported: boolean; formula?: string; sharedFormula?: string; cached: boolean; merge?: string; hidden: boolean; box: CellBox }
|
|
293
|
+
|
|
294
|
+
/** One selected worksheet's cells, with the sheet facts a reader needs beside them. */
|
|
295
|
+
export interface SheetCells {
|
|
296
|
+
sheet: string
|
|
297
|
+
/** Position in the workbook, 0-based. */
|
|
298
|
+
index: number
|
|
299
|
+
hidden: boolean
|
|
300
|
+
/** The declared `<dimension>`, which a producer may overstate. */
|
|
301
|
+
dimension?: string
|
|
302
|
+
printArea?: string
|
|
303
|
+
/** Merged ranges in A1 form. */
|
|
304
|
+
merges: Array<string>
|
|
305
|
+
/**
|
|
306
|
+
* The sheet frame's size in points: A1 to the last non-empty cell or merged range, with hidden
|
|
307
|
+
* rows and columns counted or not per `hiddenCells`.
|
|
308
|
+
*/
|
|
309
|
+
width: number
|
|
310
|
+
height: number
|
|
311
|
+
/** Points; what a column or row absent from `columns` / `rows` measures. */
|
|
312
|
+
defaultColumnWidth: number
|
|
313
|
+
defaultRowHeight: number
|
|
314
|
+
/** Only the columns and rows that differ from the default or are hidden. */
|
|
315
|
+
columns: Array<SheetColumn>
|
|
316
|
+
rows: Array<SheetRow>
|
|
317
|
+
warnings: Array<string>
|
|
318
|
+
cells: Array<SheetCell>
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** A column whose width differs from the sheet default, or that is hidden. 0-based. */
|
|
322
|
+
export interface SheetColumn {
|
|
323
|
+
index: number
|
|
324
|
+
/** Points; zero for a hidden column when hidden cells are excluded. */
|
|
325
|
+
width: number
|
|
326
|
+
hidden: boolean
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* One selected worksheet's cells keyed for lookup: `rows["12"]["C"]` is cell C12, and
|
|
331
|
+
* `rows["12"]` is the whole of row 12. Only non-empty cells are present, so a row or a column
|
|
332
|
+
* with nothing in it has no key.
|
|
333
|
+
*/
|
|
334
|
+
export interface SheetGrid {
|
|
335
|
+
sheet: string
|
|
336
|
+
/** Position in the workbook, 0-based. */
|
|
337
|
+
index: number
|
|
338
|
+
hidden: boolean
|
|
339
|
+
/** The declared `<dimension>`, which a producer may overstate. */
|
|
340
|
+
dimension?: string
|
|
341
|
+
/** Merged ranges in A1 form. */
|
|
342
|
+
merges: Array<string>
|
|
343
|
+
warnings: Array<string>
|
|
344
|
+
/**
|
|
345
|
+
* Keyed by row number as a reference writes it (`"12"`), then by column letters (`"C"`), each
|
|
346
|
+
* in sheet order.
|
|
347
|
+
*/
|
|
348
|
+
rows: Record<string, Record<string, SheetCell>>
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Words sharing a baseline band, left to right. `firstWord` / `wordCount` address a contiguous
|
|
353
|
+
* slice of `SheetPage.words`.
|
|
354
|
+
*/
|
|
355
|
+
export interface SheetLine {
|
|
356
|
+
text: string
|
|
357
|
+
x0: number
|
|
358
|
+
y0: number
|
|
359
|
+
x1: number
|
|
360
|
+
y1: number
|
|
361
|
+
firstWord: number
|
|
362
|
+
wordCount: number
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* One selected sheet laid out as a page: every cell's text placed inside the cell's rectangle,
|
|
367
|
+
* broken into words and grouped into lines, with the sheet facts a reader needs beside them.
|
|
368
|
+
*/
|
|
369
|
+
export interface SheetPage {
|
|
370
|
+
/** 1-based, in selection order. */
|
|
371
|
+
page: number
|
|
372
|
+
sheet: string
|
|
373
|
+
/** Position in the workbook, 0-based. */
|
|
374
|
+
index: number
|
|
375
|
+
hidden: boolean
|
|
376
|
+
/** The declared `<dimension>`, which a producer may overstate. */
|
|
377
|
+
dimension?: string
|
|
378
|
+
printArea?: string
|
|
379
|
+
/** Merged ranges in A1 form. */
|
|
380
|
+
merges: Array<string>
|
|
381
|
+
/**
|
|
382
|
+
* The page's size in points: the print area when the sheet has one, else A1 to the last
|
|
383
|
+
* non-empty cell, with rows grown to fit their text.
|
|
384
|
+
*/
|
|
385
|
+
width: number
|
|
386
|
+
height: number
|
|
387
|
+
words: Array<SheetWord>
|
|
388
|
+
lines: Array<SheetLine>
|
|
389
|
+
warnings: Array<string>
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* A row whose height differs from the sheet default (auto-fit growth included), or that is
|
|
394
|
+
* hidden. 0-based.
|
|
395
|
+
*/
|
|
396
|
+
export interface SheetRow {
|
|
397
|
+
index: number
|
|
398
|
+
/** Points; zero for a hidden row when hidden cells are excluded. */
|
|
399
|
+
height: number
|
|
400
|
+
hidden: boolean
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* One word of a sheet's logical page, with its box in the page frame: points, y up, the page's
|
|
405
|
+
* bottom-left corner at the origin.
|
|
406
|
+
*/
|
|
407
|
+
export interface SheetWord {
|
|
408
|
+
text: string
|
|
409
|
+
x0: number
|
|
410
|
+
y0: number
|
|
411
|
+
x1: number
|
|
412
|
+
y1: number
|
|
413
|
+
/** Index into `SheetPage.lines`. */
|
|
414
|
+
line: number
|
|
415
|
+
/** The cell's font: its size in points, its name, and whether it is bold or italic. */
|
|
416
|
+
fontSize?: number
|
|
417
|
+
fontName?: string
|
|
418
|
+
bold?: boolean
|
|
419
|
+
italic?: boolean
|
|
420
|
+
/**
|
|
421
|
+
* The reference of the cell this word was laid out from (`"C3"`); the anchor for a merged
|
|
422
|
+
* range.
|
|
423
|
+
*/
|
|
424
|
+
cell: string
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* The cells of a workbook buffer's selected sheets. Parses the buffer for this call; hold an
|
|
429
|
+
* `XlsxDown` to read the same workbook more than once.
|
|
430
|
+
*/
|
|
431
|
+
export declare function spreadsheetCells(buffer: Buffer, opts?: SpreadsheetOptions | undefined | null): Array<SheetCells>
|
|
432
|
+
|
|
433
|
+
/** `spreadsheetCells` on a worker thread: the buffer is copied, then parsed and read there. */
|
|
434
|
+
export declare function spreadsheetCellsAsync(buffer: Buffer, opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetCells>>
|
|
435
|
+
|
|
436
|
+
/** Which sheets and cells a reader returns. */
|
|
437
|
+
export interface SpreadsheetOptions {
|
|
438
|
+
/**
|
|
439
|
+
* Sheet names to include, returned in workbook order; default: every visible sheet. A sheet
|
|
440
|
+
* asked for by name is included even when it is hidden.
|
|
441
|
+
*/
|
|
442
|
+
sheets?: Array<string>
|
|
443
|
+
/** Include hidden sheets (default false). */
|
|
444
|
+
hiddenSheets?: boolean
|
|
445
|
+
/**
|
|
446
|
+
* Cells in hidden rows and columns (default true): they are listed with `hidden: true`. With
|
|
447
|
+
* false they are left out, and their rows and columns have no extent.
|
|
448
|
+
*/
|
|
449
|
+
hiddenCells?: boolean
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export interface StringField {
|
|
453
|
+
value: string
|
|
454
|
+
/** The exact source text the value was derived from. */
|
|
455
|
+
text: string
|
|
456
|
+
confidence: number
|
|
457
|
+
span?: FieldSpan
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface TaxDetail {
|
|
461
|
+
rate?: NumberField
|
|
462
|
+
amount?: MoneyField
|
|
463
|
+
base?: MoneyField
|
|
464
|
+
category?: StringField
|
|
465
|
+
}
|