Skip to main content

TableColumn

Struct TableColumn 

Source
pub struct TableColumn {
    pub name: String,
    pub field_name: String,
    pub index: usize,
    pub order: u32,
    pub width: Option<String>,
    pub format: Option<String>,
    pub align: Option<HorizontalAlignment>,
    pub converter: Option<String>,
    pub wrap: bool,
    pub ignored: bool,
}
Expand description

表格中单列的描述符。

#[derive(DocxRow)] 从字段注解生成。

对应 Java: com.alibaba.excel.metadata.ExcelColumn / ExcelProperty 注解属性

Fields§

§name: String

Column header text (displayed in the table header row).

§field_name: String

Rust field name (used for reverse lookup).

§index: usize

Zero-based column index in the table.

§order: u32

Order for column sorting (lower = leftmost).

§width: Option<String>

Column width as a CSS-like string (e.g. "2cm", "80px", "auto"), or None for auto-width.

§format: Option<String>

Number or date format pattern (e.g. "#,##0.00", "yyyy-mm-dd"), if applicable.

§align: Option<HorizontalAlignment>

Horizontal alignment override for cells in this column.

§converter: Option<String>

Custom converter type path (e.g. "StatusConverter"), used by from_row_with_converters / to_row_with_converters.

§wrap: bool

Whether text in this column should wrap.

§ignored: bool

Whether the field should be ignored during read/write.

Implementations§

Source§

impl TableColumn

Source

pub fn new( name: impl Into<String>, field_name: impl Into<String>, index: usize, ) -> Self

创建新的列描述符。

Source

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

设置显示名称。

Source

pub fn order(self, order: u32) -> Self

设置列排序顺序。

Source

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

设置列宽(CSS 风格字符串,如 "2cm""80px")。

Source

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

设置数字/日期列的格式模式。

Source

pub fn align(self, align: HorizontalAlignment) -> Self

设置此列的水平对齐方式。

Source

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

设置此列的自定义转换器类型名。

Source

pub fn wrap(self) -> Self

启用此列的文本换行。

Source

pub fn ignore(self) -> Self

标记此列在读写时被忽略。

对应 Java: ExcelProperty@ExcelIgnore 注解

Trait Implementations§

Source§

impl Clone for TableColumn

Source§

fn clone(&self) -> TableColumn

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 TableColumn

Source§

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

Formats the value using the given formatter. 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, <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.