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: FootnotesImplementations§
Source§impl Docx
impl Docx
pub fn new() -> Docx
pub fn document(self, d: Document) -> Docx
pub fn styles(self, s: Styles) -> Self
pub fn add_style(self, s: Style) -> Self
pub fn numberings(self, n: Numberings) -> Self
pub fn settings(self, s: Settings) -> Self
pub fn comments(self, c: Comments) -> Self
pub fn comments_extended(self, c: CommentsExtended) -> Self
pub fn add_paragraph(self, p: Paragraph) -> Docx
pub fn add_section(self, s: Section) -> Docx
pub fn add_structured_data_tag(self, t: StructuredDataTag) -> Docx
pub fn add_table_of_contents(self, t: TableOfContents) -> Docx
pub fn add_bookmark_start(self, id: usize, name: impl Into<String>) -> Docx
pub fn add_bookmark_end(self, id: usize) -> Docx
pub fn add_table(self, t: Table) -> Docx
pub fn header(self, header: Header) -> Self
pub fn first_header(self, header: Header) -> Self
pub fn even_header(self, header: Header) -> Self
pub fn add_abstract_numbering(self, num: AbstractNumbering) -> Docx
pub fn add_numbering(self, num: Numbering) -> Docx
pub fn created_at(self, date: &str) -> Self
pub fn updated_at(self, date: &str) -> Self
pub fn custom_property( self, name: impl Into<String>, item: impl Into<String>, ) -> Self
pub fn doc_id(self, id: &str) -> Self
pub fn default_tab_stop(self, stop: usize) -> Self
pub fn add_doc_var(self, name: &str, val: &str) -> Self
pub fn title_pg(self) -> Self
pub fn page_size(self, w: u32, h: u32) -> Self
pub fn page_margin(self, margin: PageMargin) -> Self
pub fn page_orient(self, o: PageOrientationType) -> Self
pub fn default_size(self, size: usize) -> Self
pub fn default_spacing(self, spacing: i32) -> Self
pub fn default_fonts(self, font: RunFonts) -> Self
pub fn default_line_spacing(self, spacing: LineSpacing) -> Self
pub fn taskpanes(self) -> Self
pub fn web_extension(self, ext: WebExtension) -> Self
pub fn add_custom_item(self, id: &str, xml: &str) -> Self
pub fn page_num_type(self, p: PageNumType) -> Self
Sourcepub fn build(self) -> XMLDocx
pub fn build(self) -> XMLDocx
Finalizes document-wide identifiers and relationships and renders the uncompressed OPC package parts.
This consumes the document. Call XMLDocx::pack to write a DOCX
archive.
Sourcepub fn pack<W>(self, writer: W) -> ZipResult<()>
pub fn pack<W>(self, writer: W) -> ZipResult<()>
Writes this document directly as a DOCX ZIP archive.
Unlike Docx::build followed by XMLDocx::pack, this method
streams XML package parts into the archive instead of retaining every
rendered part in a separate Vec<u8>.
pub fn json(&self) -> String
pub fn json_with_update_comments(&mut self) -> String
pub fn comments_json(&mut self) -> String
Sourcepub fn collect_footnotes(&mut self) -> bool
pub fn collect_footnotes(&mut self) -> bool
Collects footnote references from the complete main document tree.
This method remains available for callers that collect dependencies explicitly. Normal package builds collect footnotes together with images, avoiding a second traversal of the document tree.