Writing files with adobe extendscript #986
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#986
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I get js-xlsx to read XLSX Files as shown in the demo https://github.com/SheetJS/js-xlsx/tree/master/demos/extendscript. Im struggling with writing a workbook to disk.
Adding the following lines to https://github.com/SheetJS/js-xlsx/blob/master/demos/extendscript/test.jsx
var binaryString = XLSX.write(workbook, {bookType:'xlsx', bookSST:true, type: 'binary'});
var outFile = File (Folder.desktop + "/test.xlsx");
outFile.encoding = "BINARY";
outFile.open( "w" );
outFile.write (binaryString);
outFile.close ();
brings the not so usable error
Trying to hunt this down I added
#include "../../jszip.js";
#include "../../xlsx.flow.js";
instead of
xlsx.core.min.js
This results in some minor Regex Escaping Bugs of Extendscript I fixed here
24d00a02f2
.But the resulting File ist not a usable ZIP-Arhive:
Any help would be greatly appreciated.
This is related to #603
Summary:
/
in character classes (you already noticed these)For XLSX conversion the following fixes resolved the problem:
I am not quite sure why the minified version is causing issues, but it looks related to where the newline appears in a switch block. Might have to change how newlines are inserted.
You can test with the following script:
(As you probably saw, the current tests only try reading from XLSX, so none of the write code paths and none of the non-XLSX read paths have been tested in ExtendScript. We'll close this issue once the full roundtrip tests pass for all of the supported formats)
Wow, that was quick. Thanks for looking into it.
Your suggested patch works for me.
Textformats are looking great. XLSX and ODS are working as well!
Regarding the minified version: I encounter these sort of problems often in ExtendScript and minified JS. I think most ExtendScript users are happy without a minified version, beacuse these scripts are not delivered throught HTTP rather saved into the Scripts Folder of the application on a harddisk.
There's a new
xlsx.extendscript.js
amalgamation which includes everything.readFile
andwriteFile
now support the ExtendScript environment. See the demo for more details.This is great. Thank you!