pub struct Paragraph {
pub rsid_r_pr: Option<STLongHexNumber>,
pub rsid_r: Option<STLongHexNumber>,
pub rsid_del: Option<STLongHexNumber>,
pub rsid_p: Option<STLongHexNumber>,
pub rsid_r_default: Option<STLongHexNumber>,
pub p_pr: Option<Box<ParagraphProperties>>,
pub paragraph_content: Vec<ParagraphContent>,
pub extra_attrs: HashMap<String, String>,
pub extra_children: Vec<PositionedNode>,
}Fields§
§rsid_r_pr: Option<STLongHexNumber>§rsid_r: Option<STLongHexNumber>§rsid_del: Option<STLongHexNumber>§rsid_p: Option<STLongHexNumber>§rsid_r_default: Option<STLongHexNumber>§p_pr: Option<Box<ParagraphProperties>>§paragraph_content: Vec<ParagraphContent>§extra_attrs: HashMap<String, String>Unknown attributes captured for roundtrip fidelity.
extra_children: Vec<PositionedNode>Unknown child elements captured for roundtrip fidelity.
Implementations§
Source§impl Paragraph
impl Paragraph
Sourcepub fn add_hyperlink(&mut self) -> &mut Hyperlink
pub fn add_hyperlink(&mut self) -> &mut Hyperlink
Add an empty hyperlink and return a mutable reference to it.
Sourcepub fn add_bookmark_start_u32(&mut self, id: u32, name: &str)
pub fn add_bookmark_start_u32(&mut self, id: u32, name: &str)
Add a bookmark start marker.
This version accepts a u32 id for ergonomic use in writer APIs.
ECMA-376 Part 1, Section 17.13.6.1 (w:bookmarkStart).
Sourcepub fn add_bookmark_end_u32(&mut self, id: u32)
pub fn add_bookmark_end_u32(&mut self, id: u32)
Add a bookmark end marker.
This version accepts a u32 id for ergonomic use in writer APIs.
ECMA-376 Part 1, Section 17.13.6.2 (w:bookmarkEnd).
Sourcepub fn add_bookmark_start(&mut self, id: i64, name: &str)
pub fn add_bookmark_start(&mut self, id: i64, name: &str)
Add a bookmark start marker.
Sourcepub fn add_bookmark_end(&mut self, id: i64)
pub fn add_bookmark_end(&mut self, id: i64)
Add a bookmark end marker.
Sourcepub fn add_comment_range_start(&mut self, id: u32)
pub fn add_comment_range_start(&mut self, id: u32)
Add a comment range start marker.
Sourcepub fn add_comment_range_end(&mut self, id: u32)
pub fn add_comment_range_end(&mut self, id: u32)
Add a comment range end marker.
Sourcepub fn set_properties(&mut self, props: ParagraphProperties)
pub fn set_properties(&mut self, props: ParagraphProperties)
Set paragraph properties.
Sourcepub fn set_numbering(&mut self, num_id: u32, ilvl: u32)
pub fn set_numbering(&mut self, num_id: u32, ilvl: u32)
Set numbering properties (list membership) on this paragraph.
Sourcepub fn set_alignment(&mut self, alignment: STJc)
pub fn set_alignment(&mut self, alignment: STJc)
Set paragraph alignment.
Use STJc variants: Left, Center, Right, Both (justified), etc.
Sourcepub fn set_spacing(&mut self, before: Option<u32>, after: Option<u32>)
pub fn set_spacing(&mut self, before: Option<u32>, after: Option<u32>)
Set paragraph spacing (before and after, in twips).
Sourcepub fn set_indent(&mut self, left: Option<u32>, first_line: Option<u32>)
pub fn set_indent(&mut self, left: Option<u32>, first_line: Option<u32>)
Set paragraph indentation.
Sourcepub fn add_page_break(&mut self) -> &mut Self
pub fn add_page_break(&mut self) -> &mut Self
Insert a page break run into this paragraph.
Adds <w:r><w:br w:type="page"/></w:r> to the paragraph content.
ECMA-376 Part 1, Section 17.3.3.1 (w:br).
Sourcepub fn add_column_break(&mut self) -> &mut Self
pub fn add_column_break(&mut self) -> &mut Self
Insert a column break run into this paragraph.
Adds <w:r><w:br w:type="column"/></w:r> to the paragraph content.
ECMA-376 Part 1, Section 17.3.3.1 (w:br).
Sourcepub fn set_space_before(&mut self, twips: u32) -> &mut Self
pub fn set_space_before(&mut self, twips: u32) -> &mut Self
Set space before the paragraph in twips (twentieths of a point).
Modifies the <w:spacing w:before="..."/> attribute.
ECMA-376 Part 1, Section 17.3.1.33 (w:spacing).
Sourcepub fn set_space_after(&mut self, twips: u32) -> &mut Self
pub fn set_space_after(&mut self, twips: u32) -> &mut Self
Set space after the paragraph in twips (twentieths of a point).
Modifies the <w:spacing w:after="..."/> attribute.
ECMA-376 Part 1, Section 17.3.1.33 (w:spacing).
Sourcepub fn set_line_spacing(&mut self, twips: u32) -> &mut Self
pub fn set_line_spacing(&mut self, twips: u32) -> &mut Self
Set line spacing in twips.
Sets <w:spacing w:line="..." w:lineRule="auto"/>.
A value of 240 is single-spacing (12pt × 20), 360 is 1.5×, 480 is double.
ECMA-376 Part 1, Section 17.3.1.33 (w:spacing).
Sourcepub fn set_indent_left(&mut self, twips: u32) -> &mut Self
pub fn set_indent_left(&mut self, twips: u32) -> &mut Self
Set left indentation in twips.
Sets <w:ind w:left="..."/>.
ECMA-376 Part 1, Section 17.3.1.12 (w:ind).
Sourcepub fn set_indent_right(&mut self, twips: u32) -> &mut Self
pub fn set_indent_right(&mut self, twips: u32) -> &mut Self
Set right indentation in twips.
Sets <w:ind w:right="..."/>.
ECMA-376 Part 1, Section 17.3.1.12 (w:ind).
Sourcepub fn set_indent_first_line(&mut self, twips: u32) -> &mut Self
pub fn set_indent_first_line(&mut self, twips: u32) -> &mut Self
Set first-line indentation in twips.
Sets <w:ind w:firstLine="..."/>. A positive value indents the first
line; use hanging for a hanging indent (not yet exposed directly).
ECMA-376 Part 1, Section 17.3.1.12 (w:ind).
Sourcepub fn set_outline_level(&mut self, level: u8) -> &mut Self
pub fn set_outline_level(&mut self, level: u8) -> &mut Self
Set the outline level of this paragraph (0–8, where 0 = body text).
Maps to <w:outlineLvl w:val="..."/> in paragraph properties.
Levels 0–8 correspond to heading levels 1–9 in the document outline.
ECMA-376 Part 1, Section 17.3.1.20 (w:outlineLvl).
Source§impl Paragraph
impl Paragraph
Sourcepub fn add_tracked_insertion(
&mut self,
id: i64,
author: &str,
date: Option<&str>,
text: &str,
) -> &mut CTRunTrackChange
pub fn add_tracked_insertion( &mut self, id: i64, author: &str, date: Option<&str>, text: &str, ) -> &mut CTRunTrackChange
Add a tracked insertion wrapping the given text and return a mutable
reference to the CTRunTrackChange (ECMA-376 §17.13.5.16).
Sourcepub fn add_tracked_deletion(
&mut self,
id: i64,
author: &str,
date: Option<&str>,
text: &str,
) -> &mut CTRunTrackChange
pub fn add_tracked_deletion( &mut self, id: i64, author: &str, date: Option<&str>, text: &str, ) -> &mut CTRunTrackChange
Add a tracked deletion wrapping the given text and return a mutable
reference to the CTRunTrackChange (ECMA-376 §17.13.5.13).
Source§impl Paragraph
impl Paragraph
Sourcepub fn add_math(&mut self, builder: OMathBuilder) -> &mut Self
pub fn add_math(&mut self, builder: OMathBuilder) -> &mut Self
Add an Office Math expression to this paragraph.
The math element (<m:oMath> or <m:oMathPara>) is stored as a
RawXmlElement inside an extra-children slot on a synthetic run.
ECMA-376 Part 1, Section 22.1.2.77 (m:oMath).
Source§impl Paragraph
impl Paragraph
Sourcepub fn add_inline_chart(
&mut self,
rel_id: &str,
width_emu: i64,
height_emu: i64,
) -> &mut Self
pub fn add_inline_chart( &mut self, rel_id: &str, width_emu: i64, height_emu: i64, ) -> &mut Self
Add an inline chart drawing reference to this paragraph.
Inserts a <w:drawing><wp:inline>…<c:chart r:id="rel_id"/>…</wp:inline></w:drawing>
element referencing the chart part identified by rel_id.
Use DocumentBuilder::embed_chart to obtain a rel_id first.
ECMA-376 Part 1, Section 20.4.2.8 (inline).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Paragraph
impl<'de> Deserialize<'de> for Paragraph
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>,
Source§impl FromXml for Paragraph
impl FromXml for Paragraph
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>
Source§impl MathExt for Paragraph
Available on crate feature extra-children only.
impl MathExt for Paragraph
extra-children only.Source§fn math_expressions(&self) -> Vec<MathExpression>
fn math_expressions(&self) -> Vec<MathExpression>
Source§impl ParagraphExt for Paragraph
impl ParagraphExt for Paragraph
Source§fn runs(&self) -> Vec<&Run>
fn runs(&self) -> Vec<&Run>
Source§fn hyperlinks(&self) -> Vec<&Hyperlink>
fn hyperlinks(&self) -> Vec<&Hyperlink>
Source§fn properties(&self) -> Option<&ParagraphProperties>
fn properties(&self) -> Option<&ParagraphProperties>
Source§fn alignment(&self) -> Option<STJc>
fn alignment(&self) -> Option<STJc>
Source§fn indent_first_line(&self) -> Option<i64>
fn indent_first_line(&self) -> Option<i64>
Source§fn indent_hanging(&self) -> Option<i64>
fn indent_hanging(&self) -> Option<i64>
Source§fn space_before(&self) -> Option<i64>
fn space_before(&self) -> Option<i64>
Source§fn space_after(&self) -> Option<i64>
fn space_after(&self) -> Option<i64>
Source§fn line_spacing(&self) -> Option<i64>
fn line_spacing(&self) -> Option<i64>
auto rule).Source§fn line_spacing_rule(&self) -> Option<STLineSpacingRule>
fn line_spacing_rule(&self) -> Option<STLineSpacingRule>
Source§impl RevisionExt for Paragraph
Available on crate feature wml-track-changes only.
impl RevisionExt for Paragraph
wml-track-changes only.Source§fn track_changes(&self) -> Vec<TrackChange>
fn track_changes(&self) -> Vec<TrackChange>
Source§fn accepted_text(&self) -> String
fn accepted_text(&self) -> String
Source§fn rejected_text(&self) -> String
fn rejected_text(&self) -> String
Source§fn has_track_changes(&self) -> bool
fn has_track_changes(&self) -> bool
Source§impl ToXml for Paragraph
impl ToXml for Paragraph
Source§fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>
fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>
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>
Source§fn is_empty_element(&self) -> bool
fn is_empty_element(&self) -> bool
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,
<tag attrs>children</tag> or <tag attrs/>.