pub struct DocxExportOptions {Show 16 fields
pub page_width_twips: Option<u32>,
pub page_height_twips: Option<u32>,
pub margin_top_twips: Option<i32>,
pub margin_bottom_twips: Option<i32>,
pub margin_left_twips: Option<i32>,
pub margin_right_twips: Option<i32>,
pub font_family: Option<String>,
pub font_half_points: Option<usize>,
pub line_spacing_twips: Option<i32>,
pub first_line_indent_twips: Option<i32>,
pub paragraph_spacing_after_twips: Option<i32>,
pub justify: bool,
pub page_numbers: bool,
pub running_header: Option<String>,
pub heading_styles: Vec<DocxHeadingStyle>,
pub images: ExportImages,
}Expand description
Page geometry + base typography overrides for a DOCX export. Every field is optional; the
Default is “no overrides” — exactly what plain to_docx produces.
Fields§
§page_width_twips: Option<u32>Page width in twips (1/1440“). None ⇒ docx default. Pair with page_height_twips.
page_height_twips: Option<u32>Page height in twips. None ⇒ docx default.
margin_top_twips: Option<i32>Top page margin in twips. None ⇒ docx default for that edge.
margin_bottom_twips: Option<i32>Bottom page margin in twips.
margin_left_twips: Option<i32>Left page margin in twips.
margin_right_twips: Option<i32>Right page margin in twips.
font_family: Option<String>Base body font family, applied as the document default (ascii + complex-script slots, so
it also covers RTL runs). None ⇒ docx default.
font_half_points: Option<usize>Base body font size in half-points (24 = 12 pt). None ⇒ docx default.
line_spacing_twips: Option<i32>Body line spacing in twips (240 = single, 360 = 1.5×, 480 = double), applied per body
paragraph — headings keep their own style’s spacing. None ⇒ default.
first_line_indent_twips: Option<i32>First-line indent for body paragraphs, in twips. None/0 ⇒ none.
paragraph_spacing_after_twips: Option<i32>Space after each body paragraph, in twips (pt × 20). None/0 ⇒ none.
justify: boolJustify body text; otherwise it is left-aligned (ragged), or right-aligned in an RTL block.
page_numbers: boolEmit a running header carrying the page number (right-aligned) — the manuscript staple.
running_header: Option<String>Optional running-header text shown before the page number (e.g. "Lastname / TITLE").
Only used when page_numbers is set.
heading_styles: Vec<DocxHeadingStyle>Definitions for Heading1…Heading6, index 0 being level 1. Empty ⇒ the writer
falls back to DocxHeadingStyle::default_ramp over the body size, because the one
thing it must never do is leave the ids undefined for the reader to guess at.
images: ExportImagesBytes for the document’s inline images, keyed by their src.
Supplied by the caller for the same reason PdfExportOptions::font_bytes
is: this crate resolves no paths and reads no files. An image whose src
is absent here is exported as its alt text instead of failing the export —
a missing picture must not cost the writer their manuscript.
Implementations§
Source§impl DocxExportOptions
impl DocxExportOptions
Sourcepub fn plain() -> DocxExportOptions
pub fn plain() -> DocxExportOptions
docx-rs’s built-in defaults — no manuscript styling (what plain to_docx uses).
Sourcepub fn resolved_heading_styles(&self) -> Vec<DocxHeadingStyle>
pub fn resolved_heading_styles(&self) -> Vec<DocxHeadingStyle>
The heading styles to write, resolved: the caller’s when it gave any, otherwise the default ramp scaled off whatever body size this export uses.
Trait Implementations§
Source§impl Clone for DocxExportOptions
impl Clone for DocxExportOptions
Source§fn clone(&self) -> DocxExportOptions
fn clone(&self) -> DocxExportOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more