UNPKG

hy_excelize

Version:

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

70 lines (53 loc) 1.78 kB
const BaseXform = require('../base-xform'); class XdrSpPrXform extends BaseXform { render(xmlStream, model) { xmlStream.openNode('xdr:spPr'); xmlStream.openNode('a:xfrm', model.xfrm.xfrm); xmlStream.leafNode('a:off', model.xfrm.off); xmlStream.leafNode('a:ext', model.xfrm.ext); xmlStream.closeNode(); xmlStream.openNode('a:prstGeom', model.prstGeom); xmlStream.leafNode('a:avLst'); xmlStream.closeNode(); xmlStream.leafNode('a:noFill'); xmlStream.openNode('a:ln', model.ln); xmlStream.leafNode('a:noFill'); xmlStream.closeNode(); xmlStream.closeNode(); } parseOpen(node) { switch (node.name) { case 'xdr:spPr': this.model = {}; return true; case 'a:xfrm': this.model.xfrm = { xfrm: node.attributes, }; return true; case 'a:off': this.model.xfrm.off = node.attributes; return true; case 'a:ext': this.model.xfrm.ext = node.attributes; return true; case 'a:prstGeom': this.model.prstGeom = node.attributes; return true; case 'a:avLst': return true; case 'a:noFill': return true; case 'a:ln': this.model.ln = node.attributes; return true; default: throw new Error(`Unexpected xml node in parseOpen: ${JSON.stringify(node)}`); } } parseText() {} parseClose(name) { return name !== 'xdr:spPr'; } } module.exports = XdrSpPrXform;