Struct DocxProcessor

Source
pub struct DocxProcessor { /* private fields */ }
Expand description

DOCX 文档处理器

Implementations§

Source§

impl DocxProcessor

Source

pub fn new() -> Self

创建新的 DOCX 处理器

Source

pub fn load_from_bytes(&mut self, bytes: &[u8]) -> Result<()>

从字节数组加载 DOCX 文件

Source

pub fn get_content(&self) -> &str

获取文档内容

Source

pub fn create_docx_with_content(&self, new_content: &str) -> Result<Vec<u8>>

使用新内容创建 DOCX 文件

Source

pub fn extract_text_content(&self) -> Result<String>

提取纯文本内容(用于模板变量提取)

Source

pub fn process_template_in_xml(&self, _template_content: &str) -> Result<String>

处理 XML 内容中的 Handlebars 模板

Trait Implementations§

Source§

impl Default for DocxProcessor

Source§

fn default() -> Self

Returns the “default value” for a type. 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<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, 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.