Skip to main content

ChartEntry

Struct ChartEntry 

Source
pub struct ChartEntry {
    pub partname: PartName,
    pub chart: Chart,
    pub rid: String,
    pub xlsx_blob: Option<Vec<u8>>,
}
Expand description

图表条目:保存到 /ppt/charts/chartN.xml 的 chart part 元数据。

对应 python-pptx 中 SlideShapes.add_chart(...) 隐式管理的 chart part。 在 to_opc_package 阶段,每个 ChartEntry 会:

  1. 写出独立的 /ppt/charts/chartN.xml part(内容为 Chart::to_xml());
  2. slideN.xml.rels 中添加 <Relationship Type=".../chart" Target="../charts/chartN.xml"/>
  3. rid 同步回 ChartShape.frame.graphic.Chart.rid,供 <c:chart r:id="..."/> 引用。

§与 MediaEntry 的差异

  • MediaEntry 持有 blob: Vec<u8>(二进制);
  • ChartEntry 持有 chart: OxmlChart(强类型模型),写出时调用 chart.to_xml()

Fields§

§partname: PartName

chart part 路径,例如 /ppt/charts/chart1.xml

§chart: Chart

强类型 Chart 模型(包含类型/数据/标题)。

§rid: String

在 slide xml 中引用的关系 id(形如 rIdChart1)。

§xlsx_blob: Option<Vec<u8>>

嵌入式 Excel 工作簿二进制内容(TODO-004 Excel 嵌入)。

  • None:图表数据仅靠 numCache/strCache,不嵌入 Excel;
  • Some(bytes):写出时生成 /ppt/embeddings/Microsoft_Excel_WorksheetN.xlsx part + chartN.xml.rels 关系(Type=Package),并在 chart XML 中写入 <c:externalData r:id="rIdXlsxN"/> 引用。PowerPoint 打开图表时会从 该 xlsx part 读取数据源(“编辑数据” 启动 Excel)。

内容应为有效的 .xlsx 文件字节流(OOXML SpreadsheetML 包格式)。 库不校验内容有效性,PowerPoint 会按 zip + XML 解析。

Trait Implementations§

Source§

impl Clone for ChartEntry

Source§

fn clone(&self) -> ChartEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChartEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V