Spaces:
No application file
No application file
File size: 2,408 Bytes
c20f20c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | export function mtable(element, targetParent, previousSibling, nextSibling, ancestors) {
const cellsPerRowCount = Math.max(...element.children.map((row) => row.children.length))
const targetElement = {
name: 'm:m',
type: 'tag',
attribs: {},
children: [
{
name: 'm:mPr',
type: 'tag',
attribs: {},
children: [
{
name: 'm:baseJc',
type: 'tag',
attribs: {
'm:val': 'center'
},
children: []
},
{
name: 'm:plcHide',
type: 'tag',
attribs: {
'm:val': 'on'
},
children: []
},
{
name: 'm:mcs',
type: 'tag',
attribs: {},
children: [
{
name: 'm:mc',
type: 'tag',
attribs: {},
children: [
{
name: 'm:mcPr',
type: 'tag',
attribs: {},
children: [
{
name: 'm:count',
type: 'tag',
attribs: {
'm:val': cellsPerRowCount.toString()
},
children: []
},
{
name: 'm:mcJc',
type: 'tag',
attribs: {
'm:val': 'center'
},
children: []
}
]
}
]
}
]
}
]
}
]
}
targetParent.children.push(targetElement)
return targetElement
}
export function mtd(element, targetParent, previousSibling, nextSibling, ancestors) {
// table cell
const targetElement = {
name: 'm:e',
type: 'tag',
attribs: {},
children: []
}
targetParent.children.push(targetElement)
return targetElement
}
export function mtr(element, targetParent, previousSibling, nextSibling, ancestors) {
// table row
const targetElement = {
name: 'm:mr',
type: 'tag',
attribs: {},
children: []
}
targetParent.children.push(targetElement)
return targetElement
}
|