pub struct Body {
pub block_content: Vec<BlockContent>,
pub sect_pr: Option<Box<SectionProperties>>,
pub extra_children: Vec<PositionedNode>,
}Fields§
§block_content: Vec<BlockContent>§sect_pr: Option<Box<SectionProperties>>§extra_children: Vec<PositionedNode>Unknown child elements captured for roundtrip fidelity.
Implementations§
Source§impl Body
impl Body
Sourcepub fn add_paragraph(&mut self) -> &mut Paragraph
pub fn add_paragraph(&mut self) -> &mut Paragraph
Add an empty paragraph and return a mutable reference to it.
Sourcepub fn add_table(&mut self) -> &mut Table
pub fn add_table(&mut self) -> &mut Table
Add an empty table and return a mutable reference to it.
Sourcepub fn set_section_properties(&mut self, sect_pr: SectionProperties)
pub fn set_section_properties(&mut self, sect_pr: SectionProperties)
Set section properties on the body.
Source§impl Body
impl Body
Sourcepub fn add_form_field(&mut self, config: FormFieldConfig) -> &mut Self
pub fn add_form_field(&mut self, config: FormFieldConfig) -> &mut Self
Add a form field as a Structured Document Tag (<w:sdt>).
Produces a block-level SDT containing an appropriate SDT properties
element (<w:sdtPr>) and content paragraph with the default value.
ECMA-376 Part 1, Section 17.5.2.
Source§impl Body
impl Body
Sourcepub fn add_toc(&mut self, opts: TocOptions) -> &mut Self
pub fn add_toc(&mut self, opts: TocOptions) -> &mut Self
Insert a Table of Contents field at the current position.
This writes:
- An optional title paragraph styled “TOC Heading”.
- A
TOCfield spanning three paragraphs:fldChar begin,instrText,fldChar end. - A placeholder paragraph telling the user to update the field.
ECMA-376 Part 1, Section 17.16.5.58 (TOC).
Trait Implementations§
Source§impl BodyExt for Body
impl BodyExt for Body
Source§fn paragraphs(&self) -> Vec<&Paragraph>
fn paragraphs(&self) -> Vec<&Paragraph>
Get all paragraphs in the body.
Source§fn section_properties(&self) -> Option<&SectionProperties>
fn section_properties(&self) -> Option<&SectionProperties>
Get the document-level section properties (layout info).
Source§fn table_of_contents(&self) -> Vec<TableOfContents>
fn table_of_contents(&self) -> Vec<TableOfContents>
Extract all Tables of Contents from this body. Read more
Source§impl BodyRevisionExt for Body
Available on crate feature wml-track-changes only.
impl BodyRevisionExt for Body
Available on crate feature
wml-track-changes only.Source§fn all_track_changes(&self) -> Vec<TrackChange>
fn all_track_changes(&self) -> Vec<TrackChange>
All tracked changes in the document body across all paragraphs.
Source§fn accepted_text(&self) -> String
fn accepted_text(&self) -> String
Full document text with all insertions accepted and deletions removed.
Source§fn rejected_text(&self) -> String
fn rejected_text(&self) -> String
Full document text with all insertions rejected and deletions restored.
Source§impl<'de> Deserialize<'de> for Body
impl<'de> Deserialize<'de> for Body
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromXml for Body
impl FromXml for Body
Source§fn from_xml<R: BufRead>(
reader: &mut Reader<R>,
start_tag: &BytesStart<'_>,
is_empty: bool,
) -> Result<Self, ParseError>
fn from_xml<R: BufRead>( reader: &mut Reader<R>, start_tag: &BytesStart<'_>, is_empty: bool, ) -> Result<Self, ParseError>
Parse from an XML reader positioned at the start tag. Read more
Source§impl MathExt for Body
Available on crate feature extra-children only.
impl MathExt for Body
Available on crate feature
extra-children only.Source§fn math_expressions(&self) -> Vec<MathExpression>
fn math_expressions(&self) -> Vec<MathExpression>
Return all math expressions contained in this element.
Source§impl ToXml for Body
impl ToXml for Body
Source§fn write_children<W: Write>(
&self,
writer: &mut Writer<W>,
) -> Result<(), SerializeError>
fn write_children<W: Write>( &self, writer: &mut Writer<W>, ) -> Result<(), SerializeError>
Write child elements and text content inside the element.
Source§fn is_empty_element(&self) -> bool
fn is_empty_element(&self) -> bool
Whether this element has no children (self-closing).
Source§fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>
fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>
Write attributes onto the start tag and return it.
Source§fn write_element<W>(
&self,
tag: &str,
writer: &mut Writer<W>,
) -> Result<(), SerializeError>where
W: Write,
fn write_element<W>(
&self,
tag: &str,
writer: &mut Writer<W>,
) -> Result<(), SerializeError>where
W: Write,
Write a complete element:
<tag attrs>children</tag> or <tag attrs/>.Auto Trait Implementations§
impl Freeze for Body
impl RefUnwindSafe for Body
impl Send for Body
impl Sync for Body
impl Unpin for Body
impl UnsafeUnpin for Body
impl UnwindSafe for Body
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