Skip to main content

Docx

Struct Docx 

Source
pub struct Docx {
Show 23 fields pub content_type: ContentTypes, pub rels: Rels, pub document_rels: DocumentRels, pub doc_props: DocProps, pub styles: Styles, pub document: Document, pub comments: Comments, pub numberings: Numberings, pub settings: Settings, pub font_table: FontTable, pub media: Vec<(String, Vec<u8>)>, pub comments_extended: CommentsExtended, pub web_settings: WebSettings, pub taskpanes: Option<Taskpanes>, pub taskpanes_rels: TaskpanesRels, pub web_extensions: Vec<WebExtension>, pub custom_items: Vec<CustomItem>, pub custom_item_props: Vec<CustomItemProperty>, pub custom_item_rels: Vec<CustomItemRels>, pub themes: Vec<Theme>, pub images: Vec<(String, String, Image, Png)>, pub hyperlinks: Vec<(String, String, String)>, pub footnotes: Footnotes,
}

Fields§

§content_type: ContentTypes§rels: Rels§document_rels: DocumentRels§doc_props: DocProps§styles: Styles§document: Document§comments: Comments§numberings: Numberings§settings: Settings§font_table: FontTable§media: Vec<(String, Vec<u8>)>§comments_extended: CommentsExtended§web_settings: WebSettings§taskpanes: Option<Taskpanes>§taskpanes_rels: TaskpanesRels§web_extensions: Vec<WebExtension>§custom_items: Vec<CustomItem>§custom_item_props: Vec<CustomItemProperty>§custom_item_rels: Vec<CustomItemRels>§themes: Vec<Theme>§images: Vec<(String, String, Image, Png)>

Reader-only collection of images embedded in word/media/.

Each tuple is (rId, media path, original bytes, preview bytes). The preview is PNG for raster originals decoded via the image crate. Unsupported formats such as EMF keep an empty preview for downstream consumers to populate. See Png for details.

§hyperlinks: Vec<(String, String, String)>§footnotes: Footnotes

Implementations§

Source§

impl Docx

Source

pub fn new() -> Docx

Source

pub fn document(self, d: Document) -> Docx

Source

pub fn styles(self, s: Styles) -> Self

Source

pub fn add_style(self, s: Style) -> Self

Source

pub fn numberings(self, n: Numberings) -> Self

Source

pub fn settings(self, s: Settings) -> Self

Source

pub fn comments(self, c: Comments) -> Self

Source

pub fn comments_extended(self, c: CommentsExtended) -> Self

Source

pub fn add_paragraph(self, p: Paragraph) -> Docx

Source

pub fn add_section(self, s: Section) -> Docx

Source

pub fn add_structured_data_tag(self, t: StructuredDataTag) -> Docx

Source

pub fn add_table_of_contents(self, t: TableOfContents) -> Docx

Source

pub fn add_bookmark_start(self, id: usize, name: impl Into<String>) -> Docx

Source

pub fn add_bookmark_end(self, id: usize) -> Docx

Source

pub fn add_table(self, t: Table) -> Docx

Source

pub fn header(self, header: Header) -> Self

Source

pub fn first_header(self, header: Header) -> Self

Source

pub fn even_header(self, header: Header) -> Self

Source

pub fn footer(self, footer: Footer) -> Self

Source

pub fn add_abstract_numbering(self, num: AbstractNumbering) -> Docx

Source

pub fn add_numbering(self, num: Numbering) -> Docx

Source

pub fn created_at(self, date: &str) -> Self

Source

pub fn updated_at(self, date: &str) -> Self

Source

pub fn custom_property( self, name: impl Into<String>, item: impl Into<String>, ) -> Self

Source

pub fn doc_id(self, id: &str) -> Self

Source

pub fn default_tab_stop(self, stop: usize) -> Self

Source

pub fn add_doc_var(self, name: &str, val: &str) -> Self

Source

pub fn title_pg(self) -> Self

Source

pub fn page_size(self, w: u32, h: u32) -> Self

Source

pub fn page_margin(self, margin: PageMargin) -> Self

Source

pub fn page_orient(self, o: PageOrientationType) -> Self

Source

pub fn default_size(self, size: usize) -> Self

Source

pub fn default_spacing(self, spacing: i32) -> Self

Source

pub fn default_fonts(self, font: RunFonts) -> Self

Source

pub fn default_line_spacing(self, spacing: LineSpacing) -> Self

Source

pub fn taskpanes(self) -> Self

Source

pub fn web_extension(self, ext: WebExtension) -> Self

Source

pub fn add_custom_item(self, id: &str, xml: &str) -> Self

Source

pub fn page_num_type(self, p: PageNumType) -> Self

Source

pub fn build(self) -> XMLDocx

Source

pub fn json(&self) -> String

Source

pub fn json_with_update_comments(&mut self) -> String

Source

pub fn comments_json(&mut self) -> String

Source

pub fn collect_footnotes(&mut self) -> bool

Collect footnotes from all Runs to the docx footnotes node.

Trait Implementations§

Source§

impl Clone for Docx

Source§

fn clone(&self) -> Docx

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 Docx

Source§

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

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

impl Default for Docx

Source§

fn default() -> Self

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

impl Serialize for Docx

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

Auto Trait Implementations§

§

impl Freeze for Docx

§

impl RefUnwindSafe for Docx

§

impl Send for Docx

§

impl Sync for Docx

§

impl Unpin for Docx

§

impl UnsafeUnpin for Docx

§

impl UnwindSafe for Docx

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.