Skip to main content

WriteOptions

Struct WriteOptions 

Source
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

Source

pub fn new() -> Self

Source

pub fn in_memory(self) -> Self

小数据量 / 需要随机写(合并单元格、绝对定位图片)时关闭常量内存

Source

pub fn cell_image(self) -> Self

写 Excel 内嵌单元格图片(embed_image)

内嵌图片在 rust_xlsxwriter 常量内存模式下支持不完整(会直接报错), 因此这里自动关闭常量内存(等价于 in_memory()),只需调用本方法即可。

Source

pub fn without_header_style(self) -> Self

Source

pub fn auto_filter(self, enable: bool) -> Self

Source

pub fn freeze_header(self, enable: bool) -> Self

Source

pub fn image_row_height(self, height: f64) -> Self

Source

pub fn date_format(self, format: impl Into<String>) -> Self

Source

pub fn datetime_format(self, format: impl Into<String>) -> Self

Trait Implementations§

Source§

impl Clone for WriteOptions

Source§

fn clone(&self) -> Self

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 WriteOptions

Source§

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

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

impl Default for WriteOptions

Source§

fn default() -> Self

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

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.