Skip to content

Commit

Permalink
[se] Fix update reference data (#3252)
Browse files Browse the repository at this point in the history
* [se] Fix update reference data
  • Loading branch information
GoshaZotov committed Jan 22, 2023
1 parent 0a68b69 commit fd8a4a1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ var editor;
let binaryData = stream;
if (!window["AscDesktopEditor"]) {
//xlst
binaryData = null;
let jsZlib = new AscCommon.ZLib();
if (!jsZlib.open(stream)) {
//t.model.handlers.trigger("asc_onErrorUpdateExternalReference", eR.Id);
Expand All @@ -712,6 +713,10 @@ var editor;
}
}

if (!binaryData) {
return;
}

//заполняем через банарник
let oBinaryFileReader = new AscCommonExcel.BinaryFileReader(true);
//чтобы лишнего не читать, проставляю флаг копипаст
Expand Down
25 changes: 17 additions & 8 deletions cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4979,18 +4979,26 @@
//необходимо проверить, ссылкой на 2 листа одной книги
let wb = eR.getWb();
let editor;
if (!t.Api["asc_isSupportFeature"]("ooxml")) {
if (!t.Api["asc_isSupportFeature"]("ooxml") || window["AscDesktopEditor"]) {
//в этом случае запрашиваем бинарник
// в ответ приходит архив - внутри должен лежать 1 файл "Editor.bin"
let jsZlib = new AscCommon.ZLib();
if (!jsZlib.open(stream)) {
t.model.handlers.trigger("asc_onErrorUpdateExternalReference", eR.Id);
continue;
}

if (jsZlib.files && jsZlib.files.length) {
var binaryData = jsZlib.getFile(jsZlib.files[0]);
let binaryData = stream;
if (!window["AscDesktopEditor"]) {
//xlst
binaryData = null;
let jsZlib = new AscCommon.ZLib();
if (!jsZlib.open(stream)) {
t.model.handlers.trigger("asc_onErrorUpdateExternalReference", eR.Id);
continue;
}

if (jsZlib.files && jsZlib.files.length) {
binaryData = jsZlib.getFile(jsZlib.files[0]);
}
}

if (binaryData) {
editor = AscCommon.getEditorByBinSignature(binaryData);
if (editor !== AscCommon.c_oEditorId.Spreadsheet) {
continue;
Expand All @@ -5017,6 +5025,7 @@
eR && eR.updateData(wb.aWorksheets, _arrAfterPromise[i].data);
}
}

} else {
editor = AscCommon.getEditorByOOXMLSignature(stream);
if (editor !== AscCommon.c_oEditorId.Spreadsheet) {
Expand Down

0 comments on commit fd8a4a1

Please sign in to comment.