Skip to main content

OfdMetadata

Struct OfdMetadata 

Source
pub struct OfdMetadata {
Show 35 fields pub version: String, pub doc_id: Option<String>, pub title: Option<String>, pub author: Option<String>, pub creator: Option<String>, pub creator_version: Option<String>, pub creation_date: Option<NaiveDateTime>, pub creation_date_raw: Option<String>, pub mod_date: Option<NaiveDateTime>, pub mod_date_raw: Option<String>, pub max_unit_id: u32, pub bookmarks: Option<Bookmarks>, pub outlines: Option<Bookmarks>, pub custom_datas: Option<CustomDatas>, pub doc_usage: Option<String>, pub keywords: Option<String>, pub subject: Option<String>, pub application_box: Option<String>, pub content_box: Option<String>, pub clip_box: Option<String>, pub bleed_box: Option<String>, pub trim_box: Option<String>, pub signatures_path: Option<String>, pub template_pages: Vec<TemplatePage>, pub annotations_path: Option<String>, pub attachments_path: Option<String>, pub custom_tags_path: Option<String>, pub page_area_present: bool, pub doc_dir: String, pub document_file: String, pub document_res: Option<String>, pub document_res_element_present: bool, pub public_res_present: bool, pub public_res_element_present: bool, pub permissions: Option<Permissions>,
}
Expand description

OFD 文档元数据(OFD.xml 层级)。

对应 Java: ofdrw CT_DocInfo。

Fields§

§version: String

文档版本(默认: “1.0”)。

§doc_id: Option<String>

文档标识符(ofd:DocID)。

§title: Option<String>

文档标题。

§author: Option<String>

文档作者(ofd:Author)。

§creator: Option<String>

创建应用程序名称(ofd:Creator)。

§creator_version: Option<String>

创建应用程序版本(ofd:CreatorVersion)。

§creation_date: Option<NaiveDateTime>

创建日期(ofd:CreationDate)。

§creation_date_raw: Option<String>

创建日期原始文本(ofd:CreationDate),roundtrip 保真用。

保留 OFD 文件中 <ofd:CreationDate> 的原始字符串(如 "2020-01-25"), writer 优先使用此值原样输出,避免强加日期格式(如追加 T00:00:00)。

§mod_date: Option<NaiveDateTime>

最后修改日期(ofd:ModDate)。

§mod_date_raw: Option<String>

最后修改日期原始文本(ofd:ModDate),roundtrip 保真用。

保留 OFD 文件中 <ofd:ModDate> 的原始字符串,writer 优先使用此值原样输出。

§max_unit_id: u32

最大单元标识符(ofd:MaxUnitID),默认 0。

§bookmarks: Option<Bookmarks>

书签集合(ofd:Bookmarks)。

§outlines: Option<Bookmarks>

大纲集合(ofd:Outlines,即 GB/T 33190-2016 的书签大纲)。

§custom_datas: Option<CustomDatas>

自定义数据集合(ofd:CustomDatas)。

§doc_usage: Option<String>

文档用途(ofd:DocUsage),如 “Normal”。

§keywords: Option<String>

文档关键词(ofd:Keywords)。

§subject: Option<String>

文档主题(ofd:Subject),对应 ofdrw CT_DocInfo.Subject。

§application_box: Option<String>

应用区域(ofd:ApplicationBox),格式 “x y w h”。

§content_box: Option<String>

内容区域(ofd:ContentBox),格式 “x y w h”。

§clip_box: Option<String>

裁剪区域(ofd:ClipBox),格式 “x y w h”。

§bleed_box: Option<String>

出血区域(ofd:BleedBox),格式 “x y w h”。

§trim_box: Option<String>

裁切区域(ofd:TrimBox),格式 “x y w h”。

§signatures_path: Option<String>

签名容器路径(ofd:Signatures),位于 OFD.xml 的 DocBody 中,如 “/Doc_0/Signs/Signatures.xml”。

§template_pages: Vec<TemplatePage>

模板页引用(ofd:TemplatePage),位于 Document.xml 的 CommonData 中。

§annotations_path: Option<String>

注释容器路径(ofd:Annotations),位于 Document.xml 中,如 “Annots/Annotations.xml”。

§attachments_path: Option<String>

附件容器路径(ofd:Attachments),位于 Document.xml 中,如 “Attachs/Attachments.xml”。

§custom_tags_path: Option<String>

自定义标签容器路径(ofd:CustomTags),位于 Document.xml 中,如 “Tags/CustomTags.xml”。

§page_area_present: bool

原始 Document.xml 是否声明了 ofd:PageArea(ofdrw 未显式设置页面大小时省略该元素)。

§doc_dir: String

文档目录(ZIP 中的目录前缀,如 “Doc_0”)。

§document_file: String

Document XML 文件名(位于 doc_dir 下,通常为 “Document.xml”, 非标准文件可能是 “Document_0.xml”)。

§document_res: Option<String>

DocumentRes 引用(CommonData 中 <ofd:DocumentRes> 的文本,如 “DocumentRes.xml” 或非标准的 “DocumentRes_0.xml”)。

§document_res_element_present: bool

CommonData 是否声明了 ofd:DocumentRes 元素(ofdrw 样本可能把 PublicRes 引用错误指向 DocumentRes.xml 而无 DocumentRes 元素)。

§public_res_present: bool

源文档是否包含 PublicRes.xml(ofdrw 在无字体资源时不写出该文件, 但 Document.xml 中的引用仍保留)。

§public_res_element_present: bool

Document.xml 的 CommonData 是否声明了 ofd:PublicRes 引用。

§permissions: Option<Permissions>

文档权限(ofd:Permissions),如存在。

Trait Implementations§

Source§

impl Clone for OfdMetadata

Source§

fn clone(&self) -> OfdMetadata

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 OfdMetadata

Source§

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

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

impl Default for OfdMetadata

Source§

fn default() -> Self

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

impl XmlElement for OfdMetadata

Source§

fn element_name(&self) -> &'static str

对应 Java: org.ofdrw.core.basicStructure.ofd.docInfo.CT_DocInfo

仅序列化/反序列化 DocInfo 相关字段;非 XML 元素字段 (如 doc_dirdocument_file 等)保持默认值。

Source§

fn attributes(&self) -> Vec<(String, String)>

XML 属性列表。
Source§

fn child_nodes(&self) -> Vec<XmlNode>

子元素(作为 XmlNode 提供,便于嵌套序列化)。
Source§

fn from_xml(node: &XmlNode) -> Result<Self, XmlElementError>

从节点树解析(对应 ofdrw 解析侧;quick-xml 产物)。 Read more
Source§

fn text_content(&self) -> Option<&str>

文本内容(简单文本元素)。
Source§

fn to_xml(&self) -> String

手工拼接 XML(对应 ofdrw writer 侧;子元素由 child_nodes 递归)。
Source§

fn write_xml(&self, out: &mut String)

将节点树写为 XML 片段(无 XML 声明)。

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> 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> 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.