Skip to main content

DocumentBlock

Enum DocumentBlock 

Source
#[non_exhaustive]
pub enum DocumentBlock {
Show 14 variants Heading { level: u8, runs: Vec<DocumentTextRun>, }, Paragraph(Vec<DocumentTextRun>), Table(DocumentTable), List(DocumentList), Image(DocumentImage), ThematicBreak, PageBreak, ColumnBreak, CodeBlock { language: Option<String>, code: String, }, TextBox(Vec<DocumentBlock>), Footnote { id: u32, blocks: Vec<DocumentBlock>, }, Endnote { id: u32, blocks: Vec<DocumentBlock>, }, Section { blocks: Vec<DocumentBlock>, section_type: Option<String>, }, Math { omml: Option<String>, latex: Option<String>, display: bool, },
}
Expand description

文档中的后端无关块级元素。

对应 OOXML <w:body> 中的块级元素(段落/表格/列表/图片等)。 无直接 Java 对应(Java EasyExcel 不处理 DOCX),是 easydoc-rust 自创的语义模型。

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Heading

标题及其级别。

Fields

§level: u8

标题级别,范围一到六。

§runs: Vec<DocumentTextRun>

标题富文本片段。

§

Paragraph(Vec<DocumentTextRun>)

普通段落。

§

Table(DocumentTable)

表格。

§

List(DocumentList)

列表。

§

Image(DocumentImage)

图片。

§

ThematicBreak

水平分隔线。

§

PageBreak

强制分页。

§

ColumnBreak

强制分栏。

§

CodeBlock

预格式化代码块。

Fields

§language: Option<String>

可选语言标记。

§code: String

代码文本。

§

TextBox(Vec<DocumentBlock>)

文本框中的块。

§

Footnote

脚注。

Fields

§id: u32

脚注标识。

§blocks: Vec<DocumentBlock>

脚注内容。

§

Endnote

尾注。

Fields

§id: u32

尾注标识。

§blocks: Vec<DocumentBlock>

尾注内容。

§

Section

文档分区(Section),包含页面布局属性和子块。

Fields

§blocks: Vec<DocumentBlock>

分区内的块级内容。

§section_type: Option<String>

可选的分区类型标识(如 nextPage, continuous 等)。

§

Math

数学公式(OMML 原始 XML 或已转换的 LaTeX)。

Fields

§omml: Option<String>

OMML 原始 XML(<m:oMath>...</m:oMath>),或 None 表示已转换。

§latex: Option<String>

已转换的 LaTeX(行内 $...$ 用),或 None 表示需转换。

§display: bool

是否为展示公式(block display,用 $$...$$)。

Trait Implementations§

Source§

impl Clone for DocumentBlock

Source§

fn clone(&self) -> DocumentBlock

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 DocumentBlock

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DocumentBlock

Source§

fn eq(&self, other: &DocumentBlock) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DocumentBlock

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> 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 = !

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.