UNPKG

hy_excelize

Version:

买菜用。感谢:https://github.com/zurmokeeper/excelize.git

49 lines (37 loc) 1.18 kB
const BaseXform = require('../base-xform'); class XdrBlipFillXform extends BaseXform { render(xmlStream, model) { xmlStream.openNode('xdr:blipFill'); xmlStream.leafNode('a:blip', model.blip); if(model.srcRect) { xmlStream.leafNode('a:srcRect', model.srcRect); } xmlStream.openNode('a:stretch'); xmlStream.leafNode('a:fillRect'); xmlStream.closeNode(); xmlStream.closeNode(); } parseOpen(node) { switch (node.name) { case 'xdr:blipFill': this.model = {}; return true; case 'a:blip': this.model.blip = node.attributes; return true; case 'a:srcRect': this.model.srcRect = node.attributes; return true; case 'a:stretch': case 'a:fillRect': return true; default: throw new Error(`Unexpected xml node in parseOpen: ${JSON.stringify(node)}`); } } parseText() {} parseClose(name) { return name !== 'xdr:blipFill'; } } module.exports = XdrBlipFillXform;