Skip to main content

Module table

Module table 

Source
Expand description

Table:高阶表格。

表格在 OOXML 中嵌套较深(graphicFrame > graphic > graphicData > tbl), 本高阶 API 把它们“摊平“为 TableShape,并以 (row, col) 二维索引访问。

§与 python-pptx 的对应

  • pptx.table.Table ←→ TableShape
  • _Row / _Column / _Cell ←→ Row / Col / Cell(oxml 模型)。

§单元格语义

  • 每个 cell 持有 TextBody,可含多段多 Run;
  • 颜色由 Cell::fill 决定(Color::None 时不写 <a:solidFill/>);
  • 边距由 Cell::margin 决定(顺序:top, left, bottom, right)。

§限制

  • 列宽 / 行高必须显式设置(默认全 0)。
  • 表格样式通过 GUID 引用 PowerPoint 内置样式(见 crate::oxml::table::TableStyle)。

§示例

use pptx_rs::shape::TableShape;
use pptx_rs::EmuExt;
use pptx_rs::Inches;

let mut t = TableShape::new(2, 3, Inches(2.0).emu(), Inches(0.5).emu());
t.set_cell_text(0, 0, "A1").unwrap();
t.set_cell_text(0, 1, "B1").unwrap();

Structs§

TableShape
表格(行优先,行内 cell)。

Enums§

BorderSide
边框方向枚举。