pub struct TableStyle { /* private fields */ }Expand description
表格样式引用(<a:tableStyleId>{GUID}</a:tableStyleId>)。
OOXML 中表格样式通过 GUID 引用 tableStyles.xml 中定义的 <a:tblStyle>,
或引用 PowerPoint 内置样式(内置样式的 GUID 是预定义的,无需在包内定义)。
§与 python-pptx 的对应
- python-pptx
Table.apply_style(style_id)←→TableStyle::new+Table::set_style; - python-pptx 默认使用
{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}(Medium Style 2 - Accent 1)。
§内置样式
PowerPoint 内置表格样式的 GUID 是固定的,可通过 TableStyle::from_name 按名称查找。
常见样式包括 “No Style, Table Grid”、“Medium Style 2 - Accent 1” 等。
§示例
use ooxml_core::oxml::table::TableStyle;
// 按名称查找内置样式
let style = TableStyle::from_name("Medium Style 2 - Accent 1").unwrap();
assert_eq!(style.style_id(), "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}");
// 直接用 GUID 构造
let style2 = TableStyle::new("{5940675A-B579-460E-94D1-54222C63F5DA}");
assert_eq!(style2.style_id(), "{5940675A-B579-460E-94D1-54222C63F5DA}");Implementations§
Trait Implementations§
Source§impl Clone for TableStyle
impl Clone for TableStyle
Source§fn clone(&self) -> TableStyle
fn clone(&self) -> TableStyle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TableStyle
impl Debug for TableStyle
impl Eq for TableStyle
Source§impl PartialEq for TableStyle
impl PartialEq for TableStyle
Source§fn eq(&self, other: &TableStyle) -> bool
fn eq(&self, other: &TableStyle) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TableStyle
Auto Trait Implementations§
impl Freeze for TableStyle
impl RefUnwindSafe for TableStyle
impl Send for TableStyle
impl Sync for TableStyle
impl Unpin for TableStyle
impl UnsafeUnpin for TableStyle
impl UnwindSafe for TableStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.