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:
field | type | meaning |
---|---|---|
width | Option<f64> | The custom width you want to update with. |
outline_level | Option<u8> | The outline level of a column, learn more from official documentation. |
hidden | Option<u8> | Whether the column is hidden or not. |
collapsed | Option<u8> | collapse columns to group them. |
Fields§
§width: Option<f64>
§outline_level: Option<u8>
§collapsed: Option<u8>
Implementations§
Source§impl Column
impl Column
Sourcepub fn new(width: f64, outline_level: u8, hidden: u8, collapsed: u8) -> Column
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));
Sourcepub fn new_by_worksheet(
width: f64,
outline_level: u8,
hidden: u8,
collapsed: u8,
format: &Format,
work_sheet: &mut WorkSheet,
) -> Column
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§
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> 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