Skip to main content

OdtExportOptions

Struct OdtExportOptions 

Source
pub struct OdtExportOptions {
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<OdtHeadingStyle>, pub images: ExportImages, pub comments: DocumentComments, pub marks: DocumentMarks,
}
Expand description

Page geometry + base typography overrides for an ODT export. Every field is optional; the Default is “no overrides” — a plain “Standard”-styled document at ODF/LibreOffice’s own built-in page defaults (A4-ish, 2cm-ish margins — whatever the reader substitutes for an unstyled style:page-layout).

Fields§

§page_width_twips: Option<u32>

Page width in twips (1/1440“). None ⇒ no style:page-layout-properties override for this edge (the reader’s own default page size). Pair with page_height_twips.

§page_height_twips: Option<u32>

Page height in twips. None ⇒ reader default.

§margin_top_twips: Option<i32>

Top page margin in twips. None ⇒ reader 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 on the “Standard” paragraph style’s text properties (so every other named/automatic style that descends from it inherits it, complex-script runs included — ODF has no separate “ascii vs. complex-script” font slot the way OOXML does; one style:font-name covers both). None ⇒ reader default.

§font_half_points: Option<usize>

Base body font size in half-points (24 = 12 pt). None ⇒ reader default.

§line_spacing_twips: Option<i32>

Body line spacing in twips (240 = single, 360 = 1.5×, 480 = double), applied per body paragraph as fo:line-height — 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: bool

Justify body text; otherwise it is left-aligned (ragged), or right-aligned in an RTL block.

§page_numbers: bool

Emit a running header carrying the page number (right-aligned) — the manuscript staple. Written as a style:master-page’s style:header holding a paragraph with a <text:page-number> field.

§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<OdtHeadingStyle>

Definitions for heading levels 1..6, index 0 being level 1. Empty ⇒ the writer falls back to OdtHeadingStyle::default_ramp over the body size, because the one thing it must never do is leave every heading looking like undifferentiated body text.

§images: ExportImages

Bytes for the document’s inline images, keyed by their src.

Supplied by the caller for the same reason super::docx_options::DocxExportOptions::images 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: DocumentComments

Comment threads to anchor into the exported .odt as real office:annotation ranges — the ODF analog of super::docx_options::DocxExportOptions::comments. A thread’s opening note and every reply become their own office:annotation/ office:annotation-end pair (paired by a generated office:name, all sharing the thread’s own character range — see super::comment_options::DocumentComment’s doc comment for why a reply carries no range of its own), loext:resolved marks a resolved thread, and loext:parent-name threads a reply back to its root — the same LibreOffice-measured spelling document_ingest::sources::odt’s reader already expects (see M-T2b’s own doc comment in document_io::use_cases::export_odt_uc for the measurement this was checked against). Empty ⇒ no comments are written, matching plain to_odt.

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: DocumentMarks

Named positions and ranges to anchor into the exported .odt as text:bookmark / text:bookmark-start+text:bookmark-end — 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 a private attribute does not survive: see super::mark_options’s module doc for the measurement. Same addressable character space as comments.

Implementations§

Source§

impl OdtExportOptions

Source

pub fn plain() -> Self

No overrides — what plain to_odt uses.

Source

pub fn resolved_heading_styles(&self) -> Vec<OdtHeadingStyle>

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 OdtExportOptions

Source§

fn clone(&self) -> OdtExportOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OdtExportOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OdtExportOptions

Source§

fn default() -> OdtExportOptions

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for OdtExportOptions

Source§

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 PartialEq for OdtExportOptions

Source§

fn eq(&self, other: &OdtExportOptions) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OdtExportOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OdtExportOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.