pub struct Sp {
pub id: u32,
pub name: String,
pub is_placeholder: bool,
pub ph_idx: Option<u32>,
pub ph_type: Option<String>,
pub properties: ShapeProperties,
pub style: Option<ShapeStyle>,
pub text: TextBody,
pub ext_lst: Option<ExtensionList>,
pub c_nv_sp_pr_tx_box: bool,
pub locks: Option<ShapeLocks>,
}Expand description
<p:sp> 普通形状(如文本框、矩形、椭圆等)。
Fields§
§id: u32形状 ID(同一 slide 内唯一)。
name: String形状名(仅显示用)。
is_placeholder: bool是否为占位符。
ph_idx: Option<u32>占位符 idx(placeholder idx,仅当 is_placeholder)。
ph_type: Option<String>占位符类型(title / body / …)。
完整取值见 PP_PLACEHOLDER_TYPE 枚举:
title/ctrTitle/subTitlebody/ftr/dt/sldNum/hdrtbl/chart/pic/sldImg/mediaobj/vertAlign等等
当 is_placeholder=true 但 ph_type=None 时,写 XML 时默认按 body 写出。
properties: ShapeProperties形状属性(xfrm / prstGeom / 填充 / 边框)。
style: Option<ShapeStyle>主题样式引用(p:style,可选)。
text: TextBody文本体(p:txBody)。
ext_lst: Option<ExtensionList>扩展列表(p:extLst),用于承载 PowerPoint 私有扩展。
c_nv_sp_pr_tx_box: bool标记该 sp 为纯文本框(对应 <p:cNvSpPr txBox="1"/>)。
python-pptx 中 shapes.add_textbox(...) 创建的就是带这个标志的 p:sp。
该标志让 PowerPoint 把它识别为“自由文本框“而非“自选图形 + 文本“,从而
走非自动布局(不套用母版占位符约束)。
locks: Option<ShapeLocks>形状锁定属性(<a:spLocks>,可选)。
None 表示不写出 <a:spLocks> 元素。
Some(ShapeLocks { .. }) 且 is_empty() == false 时写出。
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sp
impl RefUnwindSafe for Sp
impl Send for Sp
impl Sync for Sp
impl Unpin for Sp
impl UnsafeUnpin for Sp
impl UnwindSafe for Sp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more