Struct Column

Source
pub struct Column {
    pub width: Option<f64>,
    pub outline_level: Option<u8>,
    pub hidden: Option<u8>,
    pub collapsed: Option<u8>,
    /* private fields */
}
Expand description

Column records the fields you want to update to worksheets.

§Fields:

fieldtypemeaning
widthOption<f64>The custom width you want to update with.
outline_levelOption<u8>The outline level of a column, learn more from official documentation.
hiddenOption<u8>Whether the column is hidden or not.
collapsedOption<u8>collapse columns to group them.

Fields§

§width: Option<f64>§outline_level: Option<u8>§hidden: Option<u8>§collapsed: Option<u8>

Implementations§

Source§

impl Column

Source

pub fn new(width: f64, outline_level: u8, hidden: u8, collapsed: u8) -> Column

If you need to customize each field, you can use the Column::new() method to create a Column

use edit_xlsx::Column;
let col = Column::new(15.0, 2, 1, 0);
assert_eq!(col.width, Some(15.0));
assert_eq!(col.outline_level, Some(2));
assert_eq!(col.hidden, Some(1));
assert_eq!(col.collapsed, Some(0));
Source

pub fn new_by_worksheet( width: f64, outline_level: u8, hidden: u8, collapsed: u8, format: &Format, work_sheet: &mut WorkSheet, ) -> Column

If you want to custom the format of col, you can use Column::new_by_worksheet() method. NOTICE: A Column created using the Column::new_by_worksheet() method can only be used in incoming worksheets.

use edit_xlsx::{Workbook, WorkSheetCol, Column, Format, FormatColor};
let red = Format::default().set_background_color(FormatColor::RGB(255, 0, 0));
let mut workbook = Workbook::new();
let worksheet = workbook.get_worksheet_mut(1).unwrap();
let col = Column::new_by_worksheet(15.0, 2, 1, 0, &red, worksheet);
worksheet.set_columns("A:C", &col).unwrap();
workbook.save_as("./examples/col_new_by_worksheet.xlsx").unwrap()

Trait Implementations§

Source§

impl Clone for Column

Source§

fn clone(&self) -> Column

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Column

Source§

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

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

impl Default for Column

Source§

fn default() -> Column

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

impl Copy for Column

Auto Trait Implementations§

§

impl Freeze for Column

§

impl RefUnwindSafe for Column

§

impl Send for Column

§

impl Sync for Column

§

impl Unpin for Column

§

impl UnwindSafe for Column

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> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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.