Open ouyoungs opened 9 months ago
定位到错误: /pptx-json/src/index.js
不能正确解析常规形状之外的图形:
line 750
if (custShapType && type !== "diagram") { const ext = getTextByPathList(slideXfrmNode, ["a:ext", "attrs"]); const cx = parseInt(ext["cx"]) * SLIDE_FACTOR; const cy = parseInt(ext["cy"]) * SLIDE_FACTOR; const w = parseInt(ext["cx"]) * SLIDE_FACTOR; const h = parseInt(ext["cy"]) * SLIDE_FACTOR; // TypeError: Cannot read properties of undefined (reading 'w') let d = ''; console.log(custShapType, w, h) try { d = getCustomShapePath(custShapType, w, h); } catch (e) { console.log(e, 'Error') d = ''; } return { ...data, type: "shape", cx, cy, shapType: "custom", path: d, }; }
shape.js
这里忽略了数组这种情况
export function getCustomShapePath(custShapType, w, h) { const pathLstNode = getTextByPathList(custShapType, ['a:pathLst']) let pathNodes = getTextByPathList(pathLstNode, ['a:path']) if (Array.isArray(pathNodes)) { pathNodes = pathNodes.pop() } const maxX = parseInt(pathNodes['attrs']['w']) const maxY = parseInt(pathNodes['attrs']['h']) .... ... }
test118.pptx
含有自定义形状的pptx
定位到错误: /pptx-json/src/index.js
不能正确解析常规形状之外的图形:
line 750
shape.js
这里忽略了数组这种情况