5.2 KiB
5.2 KiB
表格参数 (Table Props)
表格参数来自 TableProps(继承 TextBaseProps、PositionProps)和 TableCellProps(继承 TextBaseProps),用于 slide.addTable() 方法。
位置属性 (PositionProps)
-
x:水平位置
- 类型:
Coord(number |${number}%``) - 单位:英寸(number)或百分比(
'50%')
- 类型:
-
y:垂直位置
- 类型:
Coord - 单位:英寸或百分比
- 类型:
-
w:宽度
- 类型:
Coord - 单位:英寸或百分比
- 类型:
-
h:高度
- 类型:
Coord - 单位:英寸或百分比
- 类型:
表格专有属性 (TableProps)
-
autoPage:是否启用自动分页
- 类型:
boolean - 说明:内容溢出时自动创建新幻灯片
- 默认值:
false
- 类型:
-
autoPageCharWeight:自动分页字符权重
- 类型:
number - 取值范围:
-1.0–1.0 - 默认值:
0.0 - 说明:调整每行字符数,正值使行更长
- 类型:
-
autoPageLineWeight:自动分页行权重
- 类型:
number - 取值范围:
-1.0–1.0 - 默认值:
0.0 - 说明:调整每页行数,正值使表格更高
- 类型:
-
autoPageRepeatHeader:自动分页时重复表头
- 类型:
boolean - 默认值:
false - 始于:v3.3.0
- 类型:
-
autoPageHeaderRows:表头行数
- 类型:
number - 说明:
autoPageRepeatHeader为true时需设置 - 默认值:
1 - 示例:
2(在前两行在新页上重复) - 始于:v3.3.0
- 类型:
-
autoPageSlideStartY:自动分页新幻灯片的起始 Y 位置
- 类型:
number - 默认值:幻灯片上边距
- 类型:
-
border:表格边框
- 类型:
BorderProps | [BorderProps, BorderProps, BorderProps, BorderProps] - 取值范围:单个值应用于所有四边;数组按上右下左(TRBL)顺序应用于各边
- 类型:
-
colW:列宽
- 类型:
number | number[] - 单位:英寸
- 说明:单个值均匀分配;数组按列依次应用
- 默认值:基于
w的等宽列
- 类型:
-
fill:单元格填充
- 类型:
ShapeFillProps - 子参数:
- fill.color:填充颜色
- 类型:
Color
- 类型:
- fill.transparency:透明度
- 类型:
number - 取值范围:
0–100 - 默认值:
0
- 类型:
- fill.type:填充类型
- 类型:
'none' | 'solid' - 默认值:
'solid'
- 类型:
- fill.color:填充颜色
- 类型:
-
margin:单元格边距
- 类型:
Margin(number | [number, number, number, number]) - 单位:pt
- 说明:影响所有单元格,可被单元格级选项覆盖
- 默认值:PowerPoint 默认边距
- 类型:
-
objectName:对象名称
- 类型:
string - 说明:替代默认的 "Object N" 名称
- 默认值:
'Object 1'
- 类型:
-
rowH:行高
- 类型:
number | number[] - 单位:英寸
- 说明:单个值均匀分配;数组按行依次应用
- 默认值:基于
h的等高行
- 类型:
-
verbose:详细模式(开发工具)
- 类型:
boolean - 说明:在控制台输出自动分页计算的详细信息
- 默认值:
false
- 类型:
-
align:水平对齐
- 类型:
'left' | 'center' | 'right' | 'justify' - 默认值:
'left'
- 类型:
-
valign:垂直对齐
- 类型:
'top' | 'middle' | 'bottom' - 默认值:
'top'
- 类型:
表格行与单元格
-
TableCell:单个单元格
- 类型:
{ text?: string | TableCell[], options?: TableCellProps } - 说明:
text可为字符串或嵌套表格;options为单元格样式
- 类型:
-
TableRow:表格行
- 类型:
TableCell[] - 说明:每行由单元格数组组成
- 类型:
-
TableRowSlide:自动分页产出
- 类型:
{ rows: TableRow[] }
- 类型:
表格单元格属性 (TableCellProps)
继承 TextBaseProps。
-
autoPageCharWeight:自动分页字符权重
- 类型:
number - 取值范围:
-1.0–1.0 - 默认值:
0.0
- 类型:
-
autoPageLineWeight:自动分页行权重
- 类型:
number - 取值范围:
-1.0–1.0 - 默认值:
0.0
- 类型:
-
border:单元格边框
- 类型:
BorderProps | [BorderProps, BorderProps, BorderProps, BorderProps] - 说明:单个值应用于所有四边;数组按上右下左(TRBL)顺序
- 类型:
-
colspan:列合并
- 类型:
number - 说明:跨列数
- 类型:
-
fill:单元格填充
- 类型:
ShapeFillProps
- 类型:
-
hyperlink:单元格超链接
- 类型:
HyperlinkProps - 子参数:
- hyperlink.slide:链接到页码
- 类型:
number
- 类型:
- hyperlink.url:链接 URL
- 类型:
string
- 类型:
- hyperlink.tooltip:超链接提示
- 类型:
string
- 类型:
- hyperlink.slide:链接到页码
- 类型:
-
margin:单元格边距
- 类型:
Margin - 单位:pt
- 默认值:
0
- 类型:
-
rowspan:行合并
- 类型:
number - 说明:跨行数
- 类型:
BorderProps
用于 border 属性的类型定义。
-
type:边框类型
- 类型:
'none' | 'dash' | 'solid' - 默认值:
'solid'
- 类型:
-
color:边框颜色
- 类型:
HexColor - 格式:6 位十六进制(无
#) - 默认值:
'666666'
- 类型:
-
pt:边框粗细
- 类型:
number - 单位:pt
- 默认值:
1
- 类型:
已废弃参数 (TableProps)
| 已废弃参数 | 替代参数 | 废弃版本 |
|---|---|---|
addHeaderToEach |
autoPageRepeatHeader |
v3.3.0 |
newSlideStartY |
autoPageSlideStartY |
v3.3.0 |