pptxtojson 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/dist/index.d.ts +33 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/border.js +2 -2
- package/src/fill.js +14 -1
- package/src/pptxtojson.js +65 -23
- package/src/table.js +35 -7
- package/dist/wx.png +0 -0
package/package.json
CHANGED
package/src/border.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getSchemeColorFromTheme } from './schemeColor'
|
|
|
3
3
|
import { getTextByPathList } from './utils'
|
|
4
4
|
|
|
5
5
|
export function getBorder(node, elType, warpObj) {
|
|
6
|
-
let lineNode = node['p:spPr'
|
|
6
|
+
let lineNode = getTextByPathList(node, ['p:spPr', 'a:ln'])
|
|
7
7
|
if (!lineNode) {
|
|
8
8
|
const lnRefNode = getTextByPathList(node, ['p:style', 'a:lnRef'])
|
|
9
9
|
if (lnRefNode) {
|
|
@@ -46,7 +46,7 @@ export function getBorder(node, elType, warpObj) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
if (!borderColor) borderColor = '#
|
|
49
|
+
if (!borderColor) borderColor = '#000000'
|
|
50
50
|
else borderColor = `#${borderColor}`
|
|
51
51
|
|
|
52
52
|
const type = getTextByPathList(lineNode, ['a:prstDash', 'attrs', 'val'])
|
package/src/fill.js
CHANGED
|
@@ -459,7 +459,7 @@ export async function getSlideBackgroundFill(warpObj) {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
export async function getShapeFill(node, isSvgMode, warpObj, source) {
|
|
462
|
+
export async function getShapeFill(node, pNode, isSvgMode, warpObj, source) {
|
|
463
463
|
const fillType = getFillType(getTextByPathList(node, ['p:spPr']))
|
|
464
464
|
let type = 'color'
|
|
465
465
|
let fillValue = ''
|
|
@@ -491,6 +491,19 @@ export async function getShapeFill(node, isSvgMode, warpObj, source) {
|
|
|
491
491
|
fillValue = getSolidFill(clrName, undefined, undefined, warpObj)
|
|
492
492
|
type = 'color'
|
|
493
493
|
}
|
|
494
|
+
if (!fillValue && pNode) {
|
|
495
|
+
const grpFill = getTextByPathList(node, ['p:spPr', 'a:grpFill'])
|
|
496
|
+
if (grpFill) {
|
|
497
|
+
const grpShpFill = pNode['p:grpSpPr']
|
|
498
|
+
if (grpShpFill) {
|
|
499
|
+
const spShpNode = { 'p:spPr': grpShpFill }
|
|
500
|
+
return getShapeFill(spShpNode, node, isSvgMode, warpObj, source)
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
else if (fillType === 'NO_FILL') {
|
|
504
|
+
return isSvgMode ? 'none' : ''
|
|
505
|
+
}
|
|
506
|
+
}
|
|
494
507
|
|
|
495
508
|
return {
|
|
496
509
|
type,
|
package/src/pptxtojson.js
CHANGED
|
@@ -268,7 +268,7 @@ async function processSingleSlide(zip, sldFileName, themeContent, defaultTextSty
|
|
|
268
268
|
for (const nodeKey in nodes) {
|
|
269
269
|
if (nodes[nodeKey].constructor !== Array) nodes[nodeKey] = [nodes[nodeKey]]
|
|
270
270
|
for (const node of nodes[nodeKey]) {
|
|
271
|
-
const ret = await processNodesInSlide(nodeKey, node, warpObj, 'slide')
|
|
271
|
+
const ret = await processNodesInSlide(nodeKey, node, nodes, warpObj, 'slide')
|
|
272
272
|
if (ret) elements.push(ret)
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -314,7 +314,7 @@ async function getLayoutElements(warpObj) {
|
|
|
314
314
|
for (let i = 0; i < nodesSldLayout[nodeKey].length; i++) {
|
|
315
315
|
const ph = getTextByPathList(nodesSldLayout[nodeKey][i], ['p:nvSpPr', 'p:nvPr', 'p:ph'])
|
|
316
316
|
if (!ph) {
|
|
317
|
-
const ret = await processNodesInSlide(nodeKey, nodesSldLayout[nodeKey][i], warpObj, 'slideLayoutBg')
|
|
317
|
+
const ret = await processNodesInSlide(nodeKey, nodesSldLayout[nodeKey][i], nodesSldLayout, warpObj, 'slideLayoutBg')
|
|
318
318
|
if (ret) elements.push(ret)
|
|
319
319
|
}
|
|
320
320
|
}
|
|
@@ -322,7 +322,7 @@ async function getLayoutElements(warpObj) {
|
|
|
322
322
|
else {
|
|
323
323
|
const ph = getTextByPathList(nodesSldLayout[nodeKey], ['p:nvSpPr', 'p:nvPr', 'p:ph'])
|
|
324
324
|
if (!ph) {
|
|
325
|
-
const ret = await processNodesInSlide(nodeKey, nodesSldLayout[nodeKey], warpObj, 'slideLayoutBg')
|
|
325
|
+
const ret = await processNodesInSlide(nodeKey, nodesSldLayout[nodeKey], nodesSldLayout, warpObj, 'slideLayoutBg')
|
|
326
326
|
if (ret) elements.push(ret)
|
|
327
327
|
}
|
|
328
328
|
}
|
|
@@ -334,7 +334,7 @@ async function getLayoutElements(warpObj) {
|
|
|
334
334
|
for (let i = 0; i < nodesSldMaster[nodeKey].length; i++) {
|
|
335
335
|
const ph = getTextByPathList(nodesSldMaster[nodeKey][i], ['p:nvSpPr', 'p:nvPr', 'p:ph'])
|
|
336
336
|
if (!ph) {
|
|
337
|
-
const ret = await processNodesInSlide(nodeKey, nodesSldMaster[nodeKey][i], warpObj, 'slideMasterBg')
|
|
337
|
+
const ret = await processNodesInSlide(nodeKey, nodesSldMaster[nodeKey][i], nodesSldMaster, warpObj, 'slideMasterBg')
|
|
338
338
|
if (ret) elements.push(ret)
|
|
339
339
|
}
|
|
340
340
|
}
|
|
@@ -342,7 +342,7 @@ async function getLayoutElements(warpObj) {
|
|
|
342
342
|
else {
|
|
343
343
|
const ph = getTextByPathList(nodesSldMaster[nodeKey], ['p:nvSpPr', 'p:nvPr', 'p:ph'])
|
|
344
344
|
if (!ph) {
|
|
345
|
-
const ret = await processNodesInSlide(nodeKey, nodesSldMaster[nodeKey], warpObj, 'slideMasterBg')
|
|
345
|
+
const ret = await processNodesInSlide(nodeKey, nodesSldMaster[nodeKey], nodesSldMaster, warpObj, 'slideMasterBg')
|
|
346
346
|
if (ret) elements.push(ret)
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -390,15 +390,15 @@ function indexNodes(content) {
|
|
|
390
390
|
return { idTable, idxTable, typeTable }
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
async function processNodesInSlide(nodeKey, nodeValue, warpObj, source) {
|
|
393
|
+
async function processNodesInSlide(nodeKey, nodeValue, nodes, warpObj, source) {
|
|
394
394
|
let json
|
|
395
395
|
|
|
396
396
|
switch (nodeKey) {
|
|
397
397
|
case 'p:sp': // Shape, Text
|
|
398
|
-
json = await processSpNode(nodeValue, warpObj, source)
|
|
398
|
+
json = await processSpNode(nodeValue, nodes, warpObj, source)
|
|
399
399
|
break
|
|
400
400
|
case 'p:cxnSp': // Shape, Text
|
|
401
|
-
json = await processCxnSpNode(nodeValue, warpObj, source)
|
|
401
|
+
json = await processCxnSpNode(nodeValue, nodes, warpObj, source)
|
|
402
402
|
break
|
|
403
403
|
case 'p:pic': // Image, Video, Audio
|
|
404
404
|
json = await processPicNode(nodeValue, warpObj, source)
|
|
@@ -464,6 +464,9 @@ async function processGroupSpNode(node, warpObj, source) {
|
|
|
464
464
|
const chcx = parseInt(xfrmNode['a:chExt']['attrs']['cx']) * RATIO_EMUs_Points
|
|
465
465
|
const chcy = parseInt(xfrmNode['a:chExt']['attrs']['cy']) * RATIO_EMUs_Points
|
|
466
466
|
|
|
467
|
+
const isFlipV = getTextByPathList(xfrmNode, ['attrs', 'flipV']) === '1'
|
|
468
|
+
const isFlipH = getTextByPathList(xfrmNode, ['attrs', 'flipH']) === '1'
|
|
469
|
+
|
|
467
470
|
let rotate = getTextByPathList(xfrmNode, ['attrs', 'rot']) || 0
|
|
468
471
|
if (rotate) rotate = angleToDegrees(rotate)
|
|
469
472
|
|
|
@@ -474,12 +477,12 @@ async function processGroupSpNode(node, warpObj, source) {
|
|
|
474
477
|
for (const nodeKey in node) {
|
|
475
478
|
if (node[nodeKey].constructor === Array) {
|
|
476
479
|
for (const item of node[nodeKey]) {
|
|
477
|
-
const ret = await processNodesInSlide(nodeKey, item, warpObj, source)
|
|
480
|
+
const ret = await processNodesInSlide(nodeKey, item, node, warpObj, source)
|
|
478
481
|
if (ret) elements.push(ret)
|
|
479
482
|
}
|
|
480
483
|
}
|
|
481
484
|
else {
|
|
482
|
-
const ret = await processNodesInSlide(nodeKey, node[nodeKey], warpObj, source)
|
|
485
|
+
const ret = await processNodesInSlide(nodeKey, node[nodeKey], node, warpObj, source)
|
|
483
486
|
if (ret) elements.push(ret)
|
|
484
487
|
}
|
|
485
488
|
}
|
|
@@ -492,6 +495,8 @@ async function processGroupSpNode(node, warpObj, source) {
|
|
|
492
495
|
height: cy,
|
|
493
496
|
rotate,
|
|
494
497
|
order,
|
|
498
|
+
isFlipV,
|
|
499
|
+
isFlipH,
|
|
495
500
|
elements: elements.map(element => ({
|
|
496
501
|
...element,
|
|
497
502
|
left: (element.left - chx) * ws,
|
|
@@ -502,7 +507,7 @@ async function processGroupSpNode(node, warpObj, source) {
|
|
|
502
507
|
}
|
|
503
508
|
}
|
|
504
509
|
|
|
505
|
-
async function processSpNode(node, warpObj, source) {
|
|
510
|
+
async function processSpNode(node, pNode, warpObj, source) {
|
|
506
511
|
const name = getTextByPathList(node, ['p:nvSpPr', 'p:cNvPr', 'attrs', 'name'])
|
|
507
512
|
const idx = getTextByPathList(node, ['p:nvSpPr', 'p:nvPr', 'p:ph', 'attrs', 'idx'])
|
|
508
513
|
let type = getTextByPathList(node, ['p:nvSpPr', 'p:nvPr', 'p:ph', 'attrs', 'type'])
|
|
@@ -537,18 +542,18 @@ async function processSpNode(node, warpObj, source) {
|
|
|
537
542
|
else type = 'obj'
|
|
538
543
|
}
|
|
539
544
|
|
|
540
|
-
return await genShape(node, slideLayoutSpNode, slideMasterSpNode, name, type, order, warpObj, source)
|
|
545
|
+
return await genShape(node, pNode, slideLayoutSpNode, slideMasterSpNode, name, type, order, warpObj, source)
|
|
541
546
|
}
|
|
542
547
|
|
|
543
|
-
async function processCxnSpNode(node, warpObj, source) {
|
|
548
|
+
async function processCxnSpNode(node, pNode, warpObj, source) {
|
|
544
549
|
const name = node['p:nvCxnSpPr']['p:cNvPr']['attrs']['name']
|
|
545
550
|
const type = (node['p:nvCxnSpPr']['p:nvPr']['p:ph'] === undefined) ? undefined : node['p:nvSpPr']['p:nvPr']['p:ph']['attrs']['type']
|
|
546
551
|
const order = node['attrs']['order']
|
|
547
552
|
|
|
548
|
-
return await genShape(node, undefined, undefined, name, type, order, warpObj, source)
|
|
553
|
+
return await genShape(node, pNode, undefined, undefined, name, type, order, warpObj, source)
|
|
549
554
|
}
|
|
550
555
|
|
|
551
|
-
async function genShape(node, slideLayoutSpNode, slideMasterSpNode, name, type, order, warpObj, source) {
|
|
556
|
+
async function genShape(node, pNode, slideLayoutSpNode, slideMasterSpNode, name, type, order, warpObj, source) {
|
|
552
557
|
const xfrmList = ['p:spPr', 'a:xfrm']
|
|
553
558
|
const slideXfrmNode = getTextByPathList(node, xfrmList)
|
|
554
559
|
const slideLayoutXfrmNode = getTextByPathList(slideLayoutSpNode, xfrmList)
|
|
@@ -577,7 +582,7 @@ async function genShape(node, slideLayoutSpNode, slideMasterSpNode, name, type,
|
|
|
577
582
|
if (node['p:txBody']) content = genTextBody(node['p:txBody'], node, slideLayoutSpNode, type, warpObj)
|
|
578
583
|
|
|
579
584
|
const { borderColor, borderWidth, borderType, strokeDasharray } = getBorder(node, type, warpObj)
|
|
580
|
-
const fill = await getShapeFill(node, undefined, warpObj, source) || ''
|
|
585
|
+
const fill = await getShapeFill(node, pNode, undefined, warpObj, source) || ''
|
|
581
586
|
|
|
582
587
|
let shadow
|
|
583
588
|
const outerShdwNode = getTextByPathList(node, ['p:spPr', 'a:effectLst', 'a:outerShdw'])
|
|
@@ -735,6 +740,20 @@ async function processPicNode(node, warpObj, source) {
|
|
|
735
740
|
order,
|
|
736
741
|
}
|
|
737
742
|
}
|
|
743
|
+
|
|
744
|
+
let rect
|
|
745
|
+
const srcRectAttrs = getTextByPathList(node, ['p:blipFill', 'a:srcRect', 'attrs'])
|
|
746
|
+
if (srcRectAttrs && (srcRectAttrs.t || srcRectAttrs.b || srcRectAttrs.l || srcRectAttrs.r)) {
|
|
747
|
+
rect = {}
|
|
748
|
+
if (srcRectAttrs.t) rect.t = srcRectAttrs.t / 1000
|
|
749
|
+
if (srcRectAttrs.b) rect.b = srcRectAttrs.b / 1000
|
|
750
|
+
if (srcRectAttrs.l) rect.l = srcRectAttrs.l / 1000
|
|
751
|
+
if (srcRectAttrs.r) rect.r = srcRectAttrs.r / 1000
|
|
752
|
+
}
|
|
753
|
+
const geom = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'attrs', 'prst']) || 'rect'
|
|
754
|
+
|
|
755
|
+
const { borderColor, borderWidth, borderType, strokeDasharray } = getBorder(node, undefined, warpObj)
|
|
756
|
+
|
|
738
757
|
return {
|
|
739
758
|
type: 'image',
|
|
740
759
|
top,
|
|
@@ -746,6 +765,12 @@ async function processPicNode(node, warpObj, source) {
|
|
|
746
765
|
isFlipV,
|
|
747
766
|
isFlipH,
|
|
748
767
|
order,
|
|
768
|
+
rect,
|
|
769
|
+
geom,
|
|
770
|
+
borderColor,
|
|
771
|
+
borderWidth,
|
|
772
|
+
borderType,
|
|
773
|
+
borderStrokeDasharray: strokeDasharray,
|
|
749
774
|
}
|
|
750
775
|
}
|
|
751
776
|
|
|
@@ -781,6 +806,17 @@ async function genTable(node, warpObj) {
|
|
|
781
806
|
const { width, height } = getSize(xfrmNode, undefined, undefined)
|
|
782
807
|
|
|
783
808
|
const getTblPr = getTextByPathList(node, ['a:graphic', 'a:graphicData', 'a:tbl', 'a:tblPr'])
|
|
809
|
+
let getColsGrid = getTextByPathList(node, ['a:graphic', 'a:graphicData', 'a:tbl', 'a:tblGrid', 'a:gridCol'])
|
|
810
|
+
if (getColsGrid.constructor !== Array) getColsGrid = [getColsGrid]
|
|
811
|
+
|
|
812
|
+
const colWidths = []
|
|
813
|
+
if (getColsGrid) {
|
|
814
|
+
for (const item of getColsGrid) {
|
|
815
|
+
const colWidthParam = getTextByPathList(item, ['attrs', 'w']) || 0
|
|
816
|
+
const colWidth = parseInt(colWidthParam) * RATIO_EMUs_Points
|
|
817
|
+
colWidths.push(colWidth)
|
|
818
|
+
}
|
|
819
|
+
}
|
|
784
820
|
|
|
785
821
|
const firstRowAttr = getTblPr['attrs'] ? getTblPr['attrs']['firstRow'] : undefined
|
|
786
822
|
const firstColAttr = getTblPr['attrs'] ? getTblPr['attrs']['firstCol'] : undefined
|
|
@@ -818,13 +854,10 @@ async function genTable(node, warpObj) {
|
|
|
818
854
|
}
|
|
819
855
|
if (thisTblStyle) thisTblStyle['tblStylAttrObj'] = tblStylAttrObj
|
|
820
856
|
|
|
821
|
-
let
|
|
857
|
+
let borders = {}
|
|
822
858
|
const tblStyl = getTextByPathList(thisTblStyle, ['a:wholeTbl', 'a:tcStyle'])
|
|
823
859
|
const tblBorderStyl = getTextByPathList(tblStyl, ['a:tcBdr'])
|
|
824
|
-
if (tblBorderStyl)
|
|
825
|
-
const tbl_borders = getTableBorders(tblBorderStyl, warpObj)
|
|
826
|
-
if (tbl_borders) tbl_border = tbl_borders.bottom || tbl_borders.left || tbl_borders.right || tbl_borders.top
|
|
827
|
-
}
|
|
860
|
+
if (tblBorderStyl) borders = getTableBorders(tblBorderStyl, warpObj)
|
|
828
861
|
|
|
829
862
|
let tbl_bgcolor = ''
|
|
830
863
|
let tbl_bgFillschemeClr = getTextByPathList(thisTblStyle, ['a:tblBg', 'a:fillRef'])
|
|
@@ -840,8 +873,13 @@ async function genTable(node, warpObj) {
|
|
|
840
873
|
if (trNodes.constructor !== Array) trNodes = [trNodes]
|
|
841
874
|
|
|
842
875
|
const data = []
|
|
876
|
+
const rowHeights = []
|
|
843
877
|
for (let i = 0; i < trNodes.length; i++) {
|
|
844
878
|
const trNode = trNodes[i]
|
|
879
|
+
|
|
880
|
+
const rowHeightParam = getTextByPathList(trNodes[i], ['attrs', 'h']) || 0
|
|
881
|
+
const rowHeight = parseInt(rowHeightParam) * RATIO_EMUs_Points
|
|
882
|
+
rowHeights.push(rowHeight)
|
|
845
883
|
|
|
846
884
|
const {
|
|
847
885
|
fillColor,
|
|
@@ -900,6 +938,7 @@ async function genTable(node, warpObj) {
|
|
|
900
938
|
if (cell.fontBold || fontBold) td.fontBold = cell.fontBold || fontBold
|
|
901
939
|
if (cell.fontColor || fontColor) td.fontColor = cell.fontColor || fontColor
|
|
902
940
|
if (cell.fillColor || fillColor || tbl_bgcolor) td.fillColor = cell.fillColor || fillColor || tbl_bgcolor
|
|
941
|
+
if (cell.borders) td.borders = cell.borders
|
|
903
942
|
|
|
904
943
|
tr.push(td)
|
|
905
944
|
}
|
|
@@ -931,6 +970,7 @@ async function genTable(node, warpObj) {
|
|
|
931
970
|
if (cell.fontBold || fontBold) td.fontBold = cell.fontBold || fontBold
|
|
932
971
|
if (cell.fontColor || fontColor) td.fontColor = cell.fontColor || fontColor
|
|
933
972
|
if (cell.fillColor || fillColor || tbl_bgcolor) td.fillColor = cell.fillColor || fillColor || tbl_bgcolor
|
|
973
|
+
if (cell.borders) td.borders = cell.borders
|
|
934
974
|
|
|
935
975
|
tr.push(td)
|
|
936
976
|
}
|
|
@@ -945,7 +985,9 @@ async function genTable(node, warpObj) {
|
|
|
945
985
|
height,
|
|
946
986
|
data,
|
|
947
987
|
order,
|
|
948
|
-
|
|
988
|
+
borders,
|
|
989
|
+
rowHeights,
|
|
990
|
+
colWidths,
|
|
949
991
|
}
|
|
950
992
|
}
|
|
951
993
|
|
|
@@ -998,7 +1040,7 @@ async function genDiagram(node, warpObj) {
|
|
|
998
1040
|
const elements = []
|
|
999
1041
|
if (dgmDrwSpArray) {
|
|
1000
1042
|
for (const item of dgmDrwSpArray) {
|
|
1001
|
-
const el = await processSpNode(item, warpObj, 'diagramBg')
|
|
1043
|
+
const el = await processSpNode(item, node, warpObj, 'diagramBg')
|
|
1002
1044
|
if (el) elements.push(el)
|
|
1003
1045
|
}
|
|
1004
1046
|
}
|
package/src/table.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getTextByPathList } from './utils'
|
|
|
3
3
|
import { getBorder } from './border'
|
|
4
4
|
|
|
5
5
|
export function getTableBorders(node, warpObj) {
|
|
6
|
-
const
|
|
6
|
+
const borders = {}
|
|
7
7
|
if (node['a:bottom']) {
|
|
8
8
|
const obj = {
|
|
9
9
|
'p:spPr': {
|
|
@@ -11,7 +11,7 @@ export function getTableBorders(node, warpObj) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
const border = getBorder(obj, undefined, warpObj)
|
|
14
|
-
|
|
14
|
+
borders.bottom = border
|
|
15
15
|
}
|
|
16
16
|
if (node['a:top']) {
|
|
17
17
|
const obj = {
|
|
@@ -20,7 +20,7 @@ export function getTableBorders(node, warpObj) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
const border = getBorder(obj, undefined, warpObj)
|
|
23
|
-
|
|
23
|
+
borders.top = border
|
|
24
24
|
}
|
|
25
25
|
if (node['a:right']) {
|
|
26
26
|
const obj = {
|
|
@@ -29,7 +29,7 @@ export function getTableBorders(node, warpObj) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const border = getBorder(obj, undefined, warpObj)
|
|
32
|
-
|
|
32
|
+
borders.right = border
|
|
33
33
|
}
|
|
34
34
|
if (node['a:left']) {
|
|
35
35
|
const obj = {
|
|
@@ -38,9 +38,9 @@ export function getTableBorders(node, warpObj) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
const border = getBorder(obj, undefined, warpObj)
|
|
41
|
-
|
|
41
|
+
borders.left = border
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return borders
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export async function getTableCellParams(tcNode, thisTblStyle, cellSource, warpObj) {
|
|
@@ -55,7 +55,7 @@ export async function getTableCellParams(tcNode, thisTblStyle, cellSource, warpO
|
|
|
55
55
|
const getCelFill = getTextByPathList(tcNode, ['a:tcPr'])
|
|
56
56
|
if (getCelFill) {
|
|
57
57
|
const cellObj = { 'p:spPr': getCelFill }
|
|
58
|
-
const fill = await getShapeFill(cellObj, undefined, warpObj)
|
|
58
|
+
const fill = await getShapeFill(cellObj, undefined, false, warpObj, 'slide')
|
|
59
59
|
|
|
60
60
|
if (fill && fill.type === 'color' && fill.value) {
|
|
61
61
|
fillColor = fill.value
|
|
@@ -76,10 +76,38 @@ export async function getTableCellParams(tcNode, thisTblStyle, cellSource, warpO
|
|
|
76
76
|
if (getTextByPathList(rowTxtStyl, ['attrs', 'b']) === 'on') fontBold = true
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
let lin_bottm = getTextByPathList(tcNode, ['a:tcPr', 'a:lnB'])
|
|
80
|
+
if (!lin_bottm) {
|
|
81
|
+
if (cellSource) lin_bottm = getTextByPathList(thisTblStyle[cellSource], ['a:tcStyle', 'a:tcBdr', 'a:bottom', 'a:ln'])
|
|
82
|
+
if (!lin_bottm) lin_bottm = getTextByPathList(thisTblStyle, ['a:wholeTbl', 'a:tcStyle', 'a:tcBdr', 'a:bottom', 'a:ln'])
|
|
83
|
+
}
|
|
84
|
+
let lin_top = getTextByPathList(tcNode, ['a:tcPr', 'a:lnT'])
|
|
85
|
+
if (!lin_top) {
|
|
86
|
+
if (cellSource) lin_top = getTextByPathList(thisTblStyle[cellSource], ['a:tcStyle', 'a:tcBdr', 'a:top', 'a:ln'])
|
|
87
|
+
if (!lin_top) lin_top = getTextByPathList(thisTblStyle, ['a:wholeTbl', 'a:tcStyle', 'a:tcBdr', 'a:top', 'a:ln'])
|
|
88
|
+
}
|
|
89
|
+
let lin_left = getTextByPathList(tcNode, ['a:tcPr', 'a:lnL'])
|
|
90
|
+
if (!lin_left) {
|
|
91
|
+
if (cellSource) lin_left = getTextByPathList(thisTblStyle[cellSource], ['a:tcStyle', 'a:tcBdr', 'a:left', 'a:ln'])
|
|
92
|
+
if (!lin_left) lin_left = getTextByPathList(thisTblStyle, ['a:wholeTbl', 'a:tcStyle', 'a:tcBdr', 'a:left', 'a:ln'])
|
|
93
|
+
}
|
|
94
|
+
let lin_right = getTextByPathList(tcNode, ['a:tcPr', 'a:lnR'])
|
|
95
|
+
if (!lin_right) {
|
|
96
|
+
if (cellSource) lin_right = getTextByPathList(thisTblStyle[cellSource], ['a:tcStyle', 'a:tcBdr', 'a:right', 'a:ln'])
|
|
97
|
+
if (!lin_right) lin_right = getTextByPathList(thisTblStyle, ['a:wholeTbl', 'a:tcStyle', 'a:tcBdr', 'a:right', 'a:ln'])
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const borders = {}
|
|
101
|
+
if (lin_bottm) borders.bottom = getBorder(lin_bottm, undefined, warpObj)
|
|
102
|
+
if (lin_top) borders.top = getBorder(lin_top, undefined, warpObj)
|
|
103
|
+
if (lin_left) borders.left = getBorder(lin_left, undefined, warpObj)
|
|
104
|
+
if (lin_right) borders.right = getBorder(lin_right, undefined, warpObj)
|
|
105
|
+
|
|
79
106
|
return {
|
|
80
107
|
fillColor,
|
|
81
108
|
fontColor,
|
|
82
109
|
fontBold,
|
|
110
|
+
borders,
|
|
83
111
|
rowSpan: rowSpan ? +rowSpan : undefined,
|
|
84
112
|
colSpan: colSpan ? +colSpan : undefined,
|
|
85
113
|
vMerge: vMerge ? +vMerge : undefined,
|
package/dist/wx.png
DELETED
|
Binary file
|