Skip to content

Commit

Permalink
[ve] Make error reading not document.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
fedek1324 committed Aug 11, 2023
1 parent c07e895 commit e2cccc1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion common/openxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,9 @@
oformFieldMaster: {dir: "oform/fieldMasters", filename: "fieldMaster[N].xml", contentType: "application/vnd.openxmlformats-package.onlyf-fieldMaster+xml", relationType: "https://schemas.onlyoffice.com/relationships/oform-fieldMaster"},

//visio
visioDocument: {dir: "visio", filename: "document.xml", contentType: "application/vnd.ms-visio.drawing.main+xml", relationType: "http://schemas.microsoft.com/visio/2010/relationships/document"}
visioDocument: {dir: "visio", filename: "document.xml", contentType: "application/vnd.ms-visio.drawing.main+xml", relationType: "http://schemas.microsoft.com/visio/2010/relationships/document"},
visioDocumentWindows: {dir: "visio", filename: "windows.xml", contentType: "application/vnd.ms-visio.windows+xml", relationType: "http://schemas.microsoft.com/visio/2010/relationships/windows"},
pages: {dir: "visio/pages", filename: "pages.xml", contentType: "application/vnd.ms-visio.pages+xml", relationType: "http://schemas.microsoft.com/visio/2010/relationships/pages"}
};
openXml.TargetMode = {
internal: "Internal",
Expand Down
21 changes: 21 additions & 0 deletions draw/model/VisioDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,37 @@
}

CVisioDocument.prototype.fromZip = function(zip, context, oReadResult) {
// Maybe it should be moved to sdkjs-ooxml/visio/Editor/SerializeXml.js like in 'word' case?
// 'word' case: sdkjs-ooxml/word/Editor/SerializeXml.js
context.zip = zip;

let reader;
let doc = new AscCommon.openXml.OpenXmlPackage(zip, null);

// handle appPart and CorePart like in 'word' case

let documentPart = doc.getPartByRelationshipType(AscCommon.openXml.Types.visioDocument.relationType);
if (documentPart) {
let contentDocument = documentPart.getDocumentContent();
reader = new StaxParser(contentDocument, documentPart, context);
this.fromXml(reader);
}

let windowsPart = doc.getPartByRelationshipType(AscCommon.openXml.Types.visioDocumentWindows.relationType);
if (windowsPart) {
let contentWindows = windowsPart.getDocumentContent();
reader = new StaxParser(contentWindows, windowsPart, context);
this.Windows = new AscCommonDraw.CWindows();
this.Windows.fromXml(reader);
}

let pagesPart = doc.getPartByRelationshipType(AscCommon.openXml.Types.pages.relationType);
if (pagesPart) {
let contentPages = pagesPart.getDocumentContent();
reader = new StaxParser(contentPages, pagesPart, context);
this.Windows = new AscCommonDraw.CWindows();
this.Windows.fromXml(reader);
}
};
CVisioDocument.prototype.toZip = function(zip, context) {
let memory = new AscCommon.CMemory();
Expand Down
2 changes: 1 addition & 1 deletion tests/draw/serialize/sax-serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $(function() {
'id-view': 'editor_sdk'
});
//todo events
setTimeout(startTests, 1000);
setTimeout(startTests, 3000);

function startTests() {
QUnit.start();
Expand Down

0 comments on commit e2cccc1

Please sign in to comment.