office-oxide 0.1.0 → 0.1.1
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/lib/index.cjs +129 -0
- package/lib/index.d.ts +28 -0
- package/lib/index.js +161 -0
- package/lib/native.js +22 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/liboffice_oxide.dylib +0 -0
- package/prebuilds/darwin-x64/liboffice_oxide.dylib +0 -0
- package/prebuilds/linux-arm64/liboffice_oxide.so +0 -0
- package/prebuilds/linux-x64/liboffice_oxide.so +0 -0
- package/prebuilds/win32-arm64/office_oxide.dll +0 -0
- package/prebuilds/win32-x64/office_oxide.dll +0 -0
package/lib/index.cjs
CHANGED
|
@@ -60,6 +60,28 @@ const n = {
|
|
|
60
60
|
extractText: lib.func('HeapStr office_extract_text(const char* path, _Out_ int* error_code)'),
|
|
61
61
|
toMarkdown: lib.func('HeapStr office_to_markdown(const char* path, _Out_ int* error_code)'),
|
|
62
62
|
toHtml: lib.func('HeapStr office_to_html(const char* path, _Out_ int* error_code)'),
|
|
63
|
+
|
|
64
|
+
// XLSX writer
|
|
65
|
+
xlsxWriterNew: lib.func('void* office_xlsx_writer_new()'),
|
|
66
|
+
xlsxWriterFree: lib.func('void office_xlsx_writer_free(void* handle)'),
|
|
67
|
+
xlsxWriterAddSheet: lib.func('uint32_t office_xlsx_writer_add_sheet(void* handle, const char* name)'),
|
|
68
|
+
xlsxSheetSetCell: lib.func('void office_xlsx_sheet_set_cell(void* handle, uint32_t sheet, uint32_t row, uint32_t col, int32_t value_type, const char* value_str, double value_num)'),
|
|
69
|
+
xlsxSheetSetCellStyled: lib.func('void office_xlsx_sheet_set_cell_styled(void* handle, uint32_t sheet, uint32_t row, uint32_t col, int32_t value_type, const char* value_str, double value_num, bool bold, const char* bg_color)'),
|
|
70
|
+
xlsxSheetMergeCells: lib.func('void office_xlsx_sheet_merge_cells(void* handle, uint32_t sheet, uint32_t row, uint32_t col, uint32_t row_span, uint32_t col_span)'),
|
|
71
|
+
xlsxSheetSetColumnWidth: lib.func('void office_xlsx_sheet_set_column_width(void* handle, uint32_t sheet, uint32_t col, double width)'),
|
|
72
|
+
xlsxWriterSave: lib.func('int32_t office_xlsx_writer_save(void* handle, const char* path, _Out_ int* error_code)'),
|
|
73
|
+
xlsxWriterToBytes: lib.func('uint8_t* office_xlsx_writer_to_bytes(void* handle, _Out_ size_t* out_len, _Out_ int* error_code)'),
|
|
74
|
+
|
|
75
|
+
// PPTX writer
|
|
76
|
+
pptxWriterNew: lib.func('void* office_pptx_writer_new()'),
|
|
77
|
+
pptxWriterFree: lib.func('void office_pptx_writer_free(void* handle)'),
|
|
78
|
+
pptxWriterSetPresentationSize: lib.func('void office_pptx_writer_set_presentation_size(void* handle, uint64_t cx, uint64_t cy)'),
|
|
79
|
+
pptxWriterAddSlide: lib.func('uint32_t office_pptx_writer_add_slide(void* handle)'),
|
|
80
|
+
pptxSlideSetTitle: lib.func('void office_pptx_slide_set_title(void* handle, uint32_t slide, const char* title)'),
|
|
81
|
+
pptxSlideAddText: lib.func('void office_pptx_slide_add_text(void* handle, uint32_t slide, const char* text)'),
|
|
82
|
+
pptxSlideAddImage: lib.func('void office_pptx_slide_add_image(void* handle, uint32_t slide, const uint8_t* data, size_t len, const char* format, int64_t x, int64_t y, uint64_t cx, uint64_t cy)'),
|
|
83
|
+
pptxWriterSave: lib.func('int32_t office_pptx_writer_save(void* handle, const char* path, _Out_ int* error_code)'),
|
|
84
|
+
pptxWriterToBytes: lib.func('uint8_t* office_pptx_writer_to_bytes(void* handle, _Out_ size_t* out_len, _Out_ int* error_code)'),
|
|
63
85
|
};
|
|
64
86
|
|
|
65
87
|
class OfficeOxideError extends Error {
|
|
@@ -159,7 +181,114 @@ function extractText(p) { return oneShot(n.extractText, 'extractText', p); }
|
|
|
159
181
|
function toMarkdown(p) { return oneShot(n.toMarkdown, 'toMarkdown', p); }
|
|
160
182
|
function toHtml(p) { return oneShot(n.toHtml, 'toHtml', p); }
|
|
161
183
|
|
|
184
|
+
class XlsxWriter {
|
|
185
|
+
constructor() {
|
|
186
|
+
this._h = n.xlsxWriterNew();
|
|
187
|
+
if (!this._h) throw new OfficeOxideError(5, 'XlsxWriter.new');
|
|
188
|
+
}
|
|
189
|
+
_ensure() { if (!this._h) throw new Error('XlsxWriter is closed'); }
|
|
190
|
+
addSheet(name) {
|
|
191
|
+
this._ensure();
|
|
192
|
+
return n.xlsxWriterAddSheet(this._h, name);
|
|
193
|
+
}
|
|
194
|
+
setCell(sheet, row, col, value) {
|
|
195
|
+
this._ensure();
|
|
196
|
+
let t, s = null, num = 0;
|
|
197
|
+
if (value === null || value === undefined) t = 0;
|
|
198
|
+
else if (typeof value === 'string') { t = 1; s = value; }
|
|
199
|
+
else if (typeof value === 'number') { t = 2; num = value; }
|
|
200
|
+
else if (typeof value === 'boolean') { t = 2; num = value ? 1 : 0; }
|
|
201
|
+
else { t = 1; s = String(value); }
|
|
202
|
+
n.xlsxSheetSetCell(this._h, sheet, row, col, t, s, num);
|
|
203
|
+
}
|
|
204
|
+
setCellStyled(sheet, row, col, value, bold, bgColor) {
|
|
205
|
+
this._ensure();
|
|
206
|
+
let t, s = null, num = 0;
|
|
207
|
+
if (value === null || value === undefined) t = 0;
|
|
208
|
+
else if (typeof value === 'string') { t = 1; s = value; }
|
|
209
|
+
else if (typeof value === 'number') { t = 2; num = value; }
|
|
210
|
+
else { t = 1; s = String(value); }
|
|
211
|
+
n.xlsxSheetSetCellStyled(this._h, sheet, row, col, t, s, num, bold, bgColor || null);
|
|
212
|
+
}
|
|
213
|
+
mergeCells(sheet, row, col, rowSpan, colSpan) {
|
|
214
|
+
this._ensure();
|
|
215
|
+
n.xlsxSheetMergeCells(this._h, sheet, row, col, rowSpan, colSpan);
|
|
216
|
+
}
|
|
217
|
+
setColumnWidth(sheet, col, width) {
|
|
218
|
+
this._ensure();
|
|
219
|
+
n.xlsxSheetSetColumnWidth(this._h, sheet, col, width);
|
|
220
|
+
}
|
|
221
|
+
save(path) {
|
|
222
|
+
this._ensure();
|
|
223
|
+
const e = [0];
|
|
224
|
+
const rc = n.xlsxWriterSave(this._h, path, e);
|
|
225
|
+
if (rc !== 0) throw new OfficeOxideError(e[0], 'XlsxWriter.save');
|
|
226
|
+
}
|
|
227
|
+
toBytes() {
|
|
228
|
+
this._ensure();
|
|
229
|
+
const outLen = [0]; const e = [0];
|
|
230
|
+
const ptr = n.xlsxWriterToBytes(this._h, outLen, e);
|
|
231
|
+
if (!ptr) throw new OfficeOxideError(e[0], 'XlsxWriter.toBytes');
|
|
232
|
+
try {
|
|
233
|
+
return Buffer.from(koffi.decode(ptr, 'uint8_t', outLen[0]));
|
|
234
|
+
} finally {
|
|
235
|
+
freeBytesRaw(ptr, outLen[0]);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
close() { if (this._h) { n.xlsxWriterFree(this._h); this._h = null; } }
|
|
239
|
+
[Symbol.dispose]() { this.close(); }
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
class PptxWriter {
|
|
243
|
+
constructor() {
|
|
244
|
+
this._h = n.pptxWriterNew();
|
|
245
|
+
if (!this._h) throw new OfficeOxideError(5, 'PptxWriter.new');
|
|
246
|
+
}
|
|
247
|
+
_ensure() { if (!this._h) throw new Error('PptxWriter is closed'); }
|
|
248
|
+
setPresentationSize(cx, cy) {
|
|
249
|
+
this._ensure();
|
|
250
|
+
n.pptxWriterSetPresentationSize(this._h, BigInt(cx), BigInt(cy));
|
|
251
|
+
}
|
|
252
|
+
addSlide() {
|
|
253
|
+
this._ensure();
|
|
254
|
+
return n.pptxWriterAddSlide(this._h);
|
|
255
|
+
}
|
|
256
|
+
setSlideTitle(slide, title) {
|
|
257
|
+
this._ensure();
|
|
258
|
+
n.pptxSlideSetTitle(this._h, slide, title);
|
|
259
|
+
}
|
|
260
|
+
addSlideText(slide, text) {
|
|
261
|
+
this._ensure();
|
|
262
|
+
n.pptxSlideAddText(this._h, slide, text);
|
|
263
|
+
}
|
|
264
|
+
addSlideImage(slide, data, format, x, y, cx, cy) {
|
|
265
|
+
this._ensure();
|
|
266
|
+
const buf = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
267
|
+
n.pptxSlideAddImage(this._h, slide, buf, buf.length, format, BigInt(x), BigInt(y), BigInt(cx), BigInt(cy));
|
|
268
|
+
}
|
|
269
|
+
save(path) {
|
|
270
|
+
this._ensure();
|
|
271
|
+
const e = [0];
|
|
272
|
+
const rc = n.pptxWriterSave(this._h, path, e);
|
|
273
|
+
if (rc !== 0) throw new OfficeOxideError(e[0], 'PptxWriter.save');
|
|
274
|
+
}
|
|
275
|
+
toBytes() {
|
|
276
|
+
this._ensure();
|
|
277
|
+
const outLen = [0]; const e = [0];
|
|
278
|
+
const ptr = n.pptxWriterToBytes(this._h, outLen, e);
|
|
279
|
+
if (!ptr) throw new OfficeOxideError(e[0], 'PptxWriter.toBytes');
|
|
280
|
+
try {
|
|
281
|
+
return Buffer.from(koffi.decode(ptr, 'uint8_t', outLen[0]));
|
|
282
|
+
} finally {
|
|
283
|
+
freeBytesRaw(ptr, outLen[0]);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
close() { if (this._h) { n.pptxWriterFree(this._h); this._h = null; } }
|
|
287
|
+
[Symbol.dispose]() { this.close(); }
|
|
288
|
+
}
|
|
289
|
+
|
|
162
290
|
module.exports = {
|
|
163
291
|
OfficeOxideError, Document, EditableDocument,
|
|
292
|
+
XlsxWriter, PptxWriter,
|
|
164
293
|
version, detectFormat, extractText, toMarkdown, toHtml,
|
|
165
294
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -35,3 +35,31 @@ export function detectFormat(path: string): DocumentFormat | null;
|
|
|
35
35
|
export function extractText(path: string): string;
|
|
36
36
|
export function toMarkdown(path: string): string;
|
|
37
37
|
export function toHtml(path: string): string;
|
|
38
|
+
|
|
39
|
+
export type ImageFormat = 'png' | 'jpeg' | 'jpg' | 'gif';
|
|
40
|
+
|
|
41
|
+
export class XlsxWriter implements Disposable {
|
|
42
|
+
constructor();
|
|
43
|
+
addSheet(name: string): number;
|
|
44
|
+
setCell(sheet: number, row: number, col: number, value: CellValue): void;
|
|
45
|
+
setCellStyled(sheet: number, row: number, col: number, value: CellValue, bold: boolean, bgColor?: string | null): void;
|
|
46
|
+
mergeCells(sheet: number, row: number, col: number, rowSpan: number, colSpan: number): void;
|
|
47
|
+
setColumnWidth(sheet: number, col: number, width: number): void;
|
|
48
|
+
save(path: string): void;
|
|
49
|
+
toBytes(): Buffer;
|
|
50
|
+
close(): void;
|
|
51
|
+
[Symbol.dispose](): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export class PptxWriter implements Disposable {
|
|
55
|
+
constructor();
|
|
56
|
+
setPresentationSize(cx: number | bigint, cy: number | bigint): void;
|
|
57
|
+
addSlide(): number;
|
|
58
|
+
setSlideTitle(slide: number, title: string): void;
|
|
59
|
+
addSlideText(slide: number, text: string): void;
|
|
60
|
+
addSlideImage(slide: number, data: Uint8Array | Buffer, format: ImageFormat, x: number | bigint, y: number | bigint, cx: number | bigint, cy: number | bigint): void;
|
|
61
|
+
save(path: string): void;
|
|
62
|
+
toBytes(): Buffer;
|
|
63
|
+
close(): void;
|
|
64
|
+
[Symbol.dispose](): void;
|
|
65
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// (decoded and auto-freed via the `HeapStr` disposable type registered in
|
|
6
6
|
// native.js). Errors surface as null returns + a non-zero error code.
|
|
7
7
|
|
|
8
|
+
import koffi from 'koffi';
|
|
8
9
|
import { native } from './native.js';
|
|
9
10
|
|
|
10
11
|
export class OfficeOxideError extends Error {
|
|
@@ -171,3 +172,163 @@ export function createFromMarkdown(markdown, format, path) {
|
|
|
171
172
|
const rc = native.createFromMarkdown(markdown, format, path, err);
|
|
172
173
|
if (rc !== 0) throw new OfficeOxideError(err[0], 'createFromMarkdown');
|
|
173
174
|
}
|
|
175
|
+
|
|
176
|
+
export class XlsxWriter {
|
|
177
|
+
#handle;
|
|
178
|
+
|
|
179
|
+
constructor() {
|
|
180
|
+
this.#handle = native.xlsxWriterNew();
|
|
181
|
+
if (!this.#handle) throw new OfficeOxideError(5, 'XlsxWriter.new');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#ensure() {
|
|
185
|
+
if (!this.#handle) throw new Error('XlsxWriter is closed');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Add a worksheet; returns its 0-based index. */
|
|
189
|
+
addSheet(name) {
|
|
190
|
+
this.#ensure();
|
|
191
|
+
return native.xlsxWriterAddSheet(this.#handle, name);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Set a cell value. value: null | string | number | boolean */
|
|
195
|
+
setCell(sheet, row, col, value) {
|
|
196
|
+
this.#ensure();
|
|
197
|
+
let t, s = null, n = 0;
|
|
198
|
+
if (value === null || value === undefined) t = 0;
|
|
199
|
+
else if (typeof value === 'string') { t = 1; s = value; }
|
|
200
|
+
else if (typeof value === 'number') { t = 2; n = value; }
|
|
201
|
+
else if (typeof value === 'boolean') { t = 2; n = value ? 1 : 0; }
|
|
202
|
+
else { t = 1; s = String(value); }
|
|
203
|
+
native.xlsxSheetSetCell(this.#handle, sheet, row, col, t, s, n);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Set a cell with styling. bgColor: 6-char hex string or null. */
|
|
207
|
+
setCellStyled(sheet, row, col, value, bold, bgColor = null) {
|
|
208
|
+
this.#ensure();
|
|
209
|
+
let t, s = null, n = 0;
|
|
210
|
+
if (value === null || value === undefined) t = 0;
|
|
211
|
+
else if (typeof value === 'string') { t = 1; s = value; }
|
|
212
|
+
else if (typeof value === 'number') { t = 2; n = value; }
|
|
213
|
+
else { t = 1; s = String(value); }
|
|
214
|
+
native.xlsxSheetSetCellStyled(this.#handle, sheet, row, col, t, s, n, bold, bgColor);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Merge a rectangular range. rowSpan and colSpan must be >= 1. */
|
|
218
|
+
mergeCells(sheet, row, col, rowSpan, colSpan) {
|
|
219
|
+
this.#ensure();
|
|
220
|
+
native.xlsxSheetMergeCells(this.#handle, sheet, row, col, rowSpan, colSpan);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Set column width in Excel character units (e.g. 20.0). */
|
|
224
|
+
setColumnWidth(sheet, col, width) {
|
|
225
|
+
this.#ensure();
|
|
226
|
+
native.xlsxSheetSetColumnWidth(this.#handle, sheet, col, width);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
save(path) {
|
|
230
|
+
this.#ensure();
|
|
231
|
+
const err = [0];
|
|
232
|
+
const rc = native.xlsxWriterSave(this.#handle, path, err);
|
|
233
|
+
if (rc !== 0) throw new OfficeOxideError(err[0], 'XlsxWriter.save');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
toBytes() {
|
|
237
|
+
this.#ensure();
|
|
238
|
+
const outLen = [0];
|
|
239
|
+
const err = [0];
|
|
240
|
+
const ptr = native.xlsxWriterToBytes(this.#handle, outLen, err);
|
|
241
|
+
if (!ptr) throw new OfficeOxideError(err[0], 'XlsxWriter.toBytes');
|
|
242
|
+
try {
|
|
243
|
+
return Buffer.from(koffi.decode(ptr, 'uint8_t', outLen[0]));
|
|
244
|
+
} finally {
|
|
245
|
+
native.freeBytes(ptr, outLen[0]);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
close() {
|
|
250
|
+
if (this.#handle) {
|
|
251
|
+
native.xlsxWriterFree(this.#handle);
|
|
252
|
+
this.#handle = null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
[Symbol.dispose]() { this.close(); }
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export class PptxWriter {
|
|
260
|
+
#handle;
|
|
261
|
+
|
|
262
|
+
constructor() {
|
|
263
|
+
this.#handle = native.pptxWriterNew();
|
|
264
|
+
if (!this.#handle) throw new OfficeOxideError(5, 'PptxWriter.new');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
#ensure() {
|
|
268
|
+
if (!this.#handle) throw new Error('PptxWriter is closed');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Override canvas size. 914400 EMU = 1 inch. */
|
|
272
|
+
setPresentationSize(cx, cy) {
|
|
273
|
+
this.#ensure();
|
|
274
|
+
native.pptxWriterSetPresentationSize(this.#handle, BigInt(cx), BigInt(cy));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** Add a slide; returns its 0-based index. */
|
|
278
|
+
addSlide() {
|
|
279
|
+
this.#ensure();
|
|
280
|
+
return native.pptxWriterAddSlide(this.#handle);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Set the title of a slide. */
|
|
284
|
+
setSlideTitle(slide, title) {
|
|
285
|
+
this.#ensure();
|
|
286
|
+
native.pptxSlideSetTitle(this.#handle, slide, title);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Add a plain text paragraph to the slide body. */
|
|
290
|
+
addSlideText(slide, text) {
|
|
291
|
+
this.#ensure();
|
|
292
|
+
native.pptxSlideAddText(this.#handle, slide, text);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Embed an image on a slide.
|
|
297
|
+
* data: Buffer or Uint8Array; format: "png" | "jpeg" | "gif"
|
|
298
|
+
* x, y, cx, cy: EMU coordinates (914400 = 1 inch)
|
|
299
|
+
*/
|
|
300
|
+
addSlideImage(slide, data, format, x, y, cx, cy) {
|
|
301
|
+
this.#ensure();
|
|
302
|
+
const buf = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
303
|
+
native.pptxSlideAddImage(this.#handle, slide, buf, buf.length, format, BigInt(x), BigInt(y), BigInt(cx), BigInt(cy));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
save(path) {
|
|
307
|
+
this.#ensure();
|
|
308
|
+
const err = [0];
|
|
309
|
+
const rc = native.pptxWriterSave(this.#handle, path, err);
|
|
310
|
+
if (rc !== 0) throw new OfficeOxideError(err[0], 'PptxWriter.save');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
toBytes() {
|
|
314
|
+
this.#ensure();
|
|
315
|
+
const outLen = [0];
|
|
316
|
+
const err = [0];
|
|
317
|
+
const ptr = native.pptxWriterToBytes(this.#handle, outLen, err);
|
|
318
|
+
if (!ptr) throw new OfficeOxideError(err[0], 'PptxWriter.toBytes');
|
|
319
|
+
try {
|
|
320
|
+
return Buffer.from(koffi.decode(ptr, 'uint8_t', outLen[0]));
|
|
321
|
+
} finally {
|
|
322
|
+
native.freeBytes(ptr, outLen[0]);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
close() {
|
|
327
|
+
if (this.#handle) {
|
|
328
|
+
native.pptxWriterFree(this.#handle);
|
|
329
|
+
this.#handle = null;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
[Symbol.dispose]() { this.close(); }
|
|
334
|
+
}
|
package/lib/native.js
CHANGED
|
@@ -78,4 +78,26 @@ export const native = {
|
|
|
78
78
|
toMarkdown: lib.func('HeapStr office_to_markdown(const char* path, _Out_ int* error_code)'),
|
|
79
79
|
toHtml: lib.func('HeapStr office_to_html(const char* path, _Out_ int* error_code)'),
|
|
80
80
|
createFromMarkdown: lib.func('int32_t office_create_from_markdown(const char* markdown, const char* format, const char* path, _Out_ int* error_code)'),
|
|
81
|
+
|
|
82
|
+
// XLSX writer
|
|
83
|
+
xlsxWriterNew: lib.func('void* office_xlsx_writer_new()'),
|
|
84
|
+
xlsxWriterFree: lib.func('void office_xlsx_writer_free(void* handle)'),
|
|
85
|
+
xlsxWriterAddSheet: lib.func('uint32_t office_xlsx_writer_add_sheet(void* handle, const char* name)'),
|
|
86
|
+
xlsxSheetSetCell: lib.func('void office_xlsx_sheet_set_cell(void* handle, uint32_t sheet, uint32_t row, uint32_t col, int32_t value_type, const char* value_str, double value_num)'),
|
|
87
|
+
xlsxSheetSetCellStyled: lib.func('void office_xlsx_sheet_set_cell_styled(void* handle, uint32_t sheet, uint32_t row, uint32_t col, int32_t value_type, const char* value_str, double value_num, bool bold, const char* bg_color)'),
|
|
88
|
+
xlsxSheetMergeCells: lib.func('void office_xlsx_sheet_merge_cells(void* handle, uint32_t sheet, uint32_t row, uint32_t col, uint32_t row_span, uint32_t col_span)'),
|
|
89
|
+
xlsxSheetSetColumnWidth: lib.func('void office_xlsx_sheet_set_column_width(void* handle, uint32_t sheet, uint32_t col, double width)'),
|
|
90
|
+
xlsxWriterSave: lib.func('int32_t office_xlsx_writer_save(void* handle, const char* path, _Out_ int* error_code)'),
|
|
91
|
+
xlsxWriterToBytes: lib.func('uint8_t* office_xlsx_writer_to_bytes(void* handle, _Out_ size_t* out_len, _Out_ int* error_code)'),
|
|
92
|
+
|
|
93
|
+
// PPTX writer
|
|
94
|
+
pptxWriterNew: lib.func('void* office_pptx_writer_new()'),
|
|
95
|
+
pptxWriterFree: lib.func('void office_pptx_writer_free(void* handle)'),
|
|
96
|
+
pptxWriterSetPresentationSize: lib.func('void office_pptx_writer_set_presentation_size(void* handle, uint64_t cx, uint64_t cy)'),
|
|
97
|
+
pptxWriterAddSlide: lib.func('uint32_t office_pptx_writer_add_slide(void* handle)'),
|
|
98
|
+
pptxSlideSetTitle: lib.func('void office_pptx_slide_set_title(void* handle, uint32_t slide, const char* title)'),
|
|
99
|
+
pptxSlideAddText: lib.func('void office_pptx_slide_add_text(void* handle, uint32_t slide, const char* text)'),
|
|
100
|
+
pptxSlideAddImage: lib.func('void office_pptx_slide_add_image(void* handle, uint32_t slide, const uint8_t* data, size_t len, const char* format, int64_t x, int64_t y, uint64_t cx, uint64_t cy)'),
|
|
101
|
+
pptxWriterSave: lib.func('int32_t office_pptx_writer_save(void* handle, const char* path, _Out_ int* error_code)'),
|
|
102
|
+
pptxWriterToBytes: lib.func('uint8_t* office_pptx_writer_to_bytes(void* handle, _Out_ size_t* out_len, _Out_ int* error_code)'),
|
|
81
103
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "office-oxide",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Fast Office document processing (DOCX/XLSX/PPTX/DOC/XLS/PPT) for Node.js — native bindings backed by the Rust office_oxide library.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "Yury Fedoseev",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|