/** * Extend this class when the new class needs to generate an xml file and .rels files * for all linked relationships * * @private */Ext.define('Ext.exporter.file.ooxml.XmlRels', { extend: 'Ext.exporter.file.ooxml.Xml', requires: [ 'Ext.exporter.file.ooxml.Relationships' ], config: { index: null, name: null, folder: null, fileName: null, relationships: { contentType: { contentType: 'application/vnd.openxmlformats-package.relationships+xml' } } }, tplNonAttributes: [ 'index', 'folder', 'fileName', 'relationships' ], contentType: {}, relationship: {}, destroy: function(){ this.setRelationships(null); this.callParent(); }, applyRelationships: function(data){ if(!data || data.isRelationships){ return data; } return new Ext.exporter.file.ooxml.Relationships(data); }, updateRelationships: function(data, oldData){ Ext.destroy(oldData); }, /** * Collect all files that are part of the final zip file * @param {Object} files Object key is the path to the file and object value is the content */ collectFiles: function(files){ var me = this, path = me.getPath(), name, rels; rels = me.getRelationships(); if(!path){ path = '/xl/' + me.getFolder() + '/'; name = me.getFileName() + me.getIndex() + '.xml'; me.getRelationship().setTarget(path + name); me.setPath(path + name); me.getContentType().setPartName(path + name); rels.getContentType().setPartName(path + '_rels/' + name + '.rels'); rels.setPath(path + '_rels/' + name + '.rels'); me.getRelationships().collectFiles(files); files[me.getPath()] = me.render(); } }, /** * Collect all content types that are part of the final zip file * @param {Ext.exporter.file.ooxml.ContentType[]} types */ collectContentTypes: function(types){ types.push(this.getContentType()); } });