pub struct CT_Body {
pub content: Vec<BodyContent>,
pub sect_pr: Option<CT_SectPr>,
}Expand description
CT_Body — The document body containing paragraphs, tables, and section properties.
Fields§
§content: Vec<BodyContent>Mixed content: paragraphs and tables in document order.
sect_pr: Option<CT_SectPr>Implementations§
Source§impl CT_Body
impl CT_Body
pub fn new() -> Self
Sourcepub fn paragraphs(&self) -> impl Iterator<Item = &CT_P>
pub fn paragraphs(&self) -> impl Iterator<Item = &CT_P>
Get an iterator over only the paragraphs.
Sourcepub fn paragraphs_mut(&mut self) -> impl Iterator<Item = &mut CT_P>
pub fn paragraphs_mut(&mut self) -> impl Iterator<Item = &mut CT_P>
Get a mutable iterator over only the paragraphs.
Sourcepub fn tables_mut(&mut self) -> impl Iterator<Item = &mut CT_Tbl>
pub fn tables_mut(&mut self) -> impl Iterator<Item = &mut CT_Tbl>
Get a mutable iterator over only the tables.
Sourcepub fn add_paragraph(&mut self, p: CT_P)
pub fn add_paragraph(&mut self, p: CT_P)
Add a paragraph to the body.
Sourcepub fn content_count(&self) -> usize
pub fn content_count(&self) -> usize
Get the number of body content elements (paragraphs + tables).
Sourcepub fn insert_paragraph(&mut self, index: usize, p: CT_P)
pub fn insert_paragraph(&mut self, index: usize, p: CT_P)
Insert a paragraph at the given index.
Panics if index > content_count().
Sourcepub fn insert_table(&mut self, index: usize, tbl: CT_Tbl)
pub fn insert_table(&mut self, index: usize, tbl: CT_Tbl)
Insert a table at the given index.
Panics if index > content_count().
Sourcepub fn find_paragraph_index(&self, text: &str) -> Option<usize>
pub fn find_paragraph_index(&self, text: &str) -> Option<usize>
Find the index of the first paragraph whose text contains the given substring.
Sourcepub fn remove(&mut self, index: usize) -> Option<BodyContent>
pub fn remove(&mut self, index: usize) -> Option<BodyContent>
Remove and return the content at the given index, or None if out of bounds.
Sourcepub fn get(&self, index: usize) -> Option<&BodyContent>
pub fn get(&self, index: usize) -> Option<&BodyContent>
Get a reference to the content at the given index.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut BodyContent>
pub fn get_mut(&mut self, index: usize) -> Option<&mut BodyContent>
Get a mutable reference to the content at the given index.