pub struct WriteOptions {
pub header_style: bool,
pub freeze_header: bool,
pub auto_filter: bool,
pub default_row_height: Option<f64>,
pub image_row_height: f64,
pub date_format: String,
pub datetime_format: String,
pub constant_memory: bool,
pub cell_image: bool,
}Expand description
写出选项
Fields§
§header_style: bool表头样式(加粗 + 底色 + 居中)
freeze_header: bool冻结表头行
auto_filter: bool自动筛选
default_row_height: Option<f64>默认行高
image_row_height: f64含图片的行高(图片嵌入后按行高缩放)
date_format: String日期默认格式
datetime_format: String日期时间默认格式
constant_memory: bool常量内存模式(百万行必须开启;开启后只能按行号递增写入)
cell_image: bool是否写 Excel「置于单元格内」图片(embed_image)
默认写标准锚点图片(insert_image):常量内存模式下可用、且能被
本工具的读取端(drawing 锚点)与 Excel / WPS 正常识别。
注意:embed_image 在 rust_xlsxwriter 常量内存模式下会报错,
且生成的是 xl/richData/*(Excel 内嵌图片);请用 WriteOptions::cell_image
开启——它会自动关闭常量内存;直接改字段的话请配合 constant_memory = false。
Implementations§
Source§impl WriteOptions
impl WriteOptions
pub fn new() -> Self
Sourcepub fn cell_image(self) -> Self
pub fn cell_image(self) -> Self
写 Excel 内嵌单元格图片(embed_image)
内嵌图片在 rust_xlsxwriter 常量内存模式下支持不完整(会直接报错),
因此这里自动关闭常量内存(等价于 in_memory()),只需调用本方法即可。
pub fn without_header_style(self) -> Self
pub fn auto_filter(self, enable: bool) -> Self
pub fn freeze_header(self, enable: bool) -> Self
pub fn image_row_height(self, height: f64) -> Self
pub fn date_format(self, format: impl Into<String>) -> Self
pub fn datetime_format(self, format: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for WriteOptions
impl Clone for WriteOptions
Source§impl Debug for WriteOptions
impl Debug for WriteOptions
Auto Trait Implementations§
impl Freeze for WriteOptions
impl RefUnwindSafe for WriteOptions
impl Send for WriteOptions
impl Sync for WriteOptions
impl Unpin for WriteOptions
impl UnsafeUnpin for WriteOptions
impl UnwindSafe for WriteOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more