pub struct Document { /* private fields */ }Expand description
A DOCX document
Implementations§
Source§impl Document
impl Document
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Open a document from bytes
Sourcepub fn paragraphs(&self) -> impl Iterator<Item = &Paragraph>
pub fn paragraphs(&self) -> impl Iterator<Item = &Paragraph>
Get all paragraphs
Sourcepub fn paragraph_count(&self) -> usize
pub fn paragraph_count(&self) -> usize
Get paragraph count
Sourcepub fn table_count(&self) -> usize
pub fn table_count(&self) -> usize
Get table count
Sourcepub fn add_paragraph(&mut self, text: impl Into<String>) -> &mut Paragraph
pub fn add_paragraph(&mut self, text: impl Into<String>) -> &mut Paragraph
Add a paragraph with text
Sourcepub fn add_empty_paragraph(&mut self) -> &mut Paragraph
pub fn add_empty_paragraph(&mut self) -> &mut Paragraph
Add an empty paragraph
Sourcepub fn numbering_mut(&mut self) -> Option<&mut Numbering>
pub fn numbering_mut(&mut self) -> Option<&mut Numbering>
Get mutable numbering definitions
Sourcepub fn is_list_item(&self, para: &Paragraph) -> bool
pub fn is_list_item(&self, para: &Paragraph) -> bool
Check if a paragraph is a list item
Sourcepub fn is_bullet_list_item(&self, para: &Paragraph) -> bool
pub fn is_bullet_list_item(&self, para: &Paragraph) -> bool
Check if a paragraph is a bullet list item
Sourcepub fn list_level(&self, para: &Paragraph) -> Option<u32>
pub fn list_level(&self, para: &Paragraph) -> Option<u32>
Get the list level of a paragraph (0-8), or None if not a list item
Sourcepub fn list_format(&self, para: &Paragraph) -> Option<&NumberFormat>
pub fn list_format(&self, para: &Paragraph) -> Option<&NumberFormat>
Get the number format for a list item
Sourcepub fn add_table_with_size(&mut self, rows: usize, cols: usize) -> &mut Table
pub fn add_table_with_size(&mut self, rows: usize, cols: usize) -> &mut Table
Create and add a table with specified rows and columns
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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