pub struct DocxExportOptions {Show 18 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,
pub comments: DocumentComments,
pub marks: DocumentMarks,
}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.
comments: DocumentCommentsComment threads to anchor into the exported .docx as real, native Word comments
(w:commentRangeStart/w:commentRangeEnd around the anchored text, w15:done for a
resolved thread, replies threaded via w15:paraIdParent). Empty ⇒ no comments are
written, matching plain to_docx.
Ranges are in the document’s addressable character space — see
super::comment_options::DocumentComment’s doc comment for what that means and why
it is not the same space FormatRun byte offsets live in.
marks: DocumentMarksNamed positions and ranges to anchor into the exported .docx as
w:bookmarkStart/w:bookmarkEnd — the carrier a host uses to recognise its own rows and
comments when the file comes back from an editor. Empty ⇒ none are written.
Bookmarks and not a private attribute, because Word does not preserve a private attribute
on <w:comment> — see super::mark_options’s module doc for the measurement. Same
addressable character space as comments.
Implementations§
Source§impl DocxExportOptions
impl DocxExportOptions
Sourcepub fn plain() -> Self
pub fn plain() -> Self
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