Packages
umya_spreadsheet_ex
0.7.0
Elixir NIF wrapper for the umya-spreadsheet Rust library, providing Excel (.xlsx) file manipulation capabilities.
Current section
Files
Jump to
Current section
Files
native/umya_native/src/helpers/alignment_helper.rs
use umya_spreadsheet::{HorizontalAlignmentValues, VerticalAlignmentValues};
pub fn parse_horizontal_alignment(alignment: &str) -> HorizontalAlignmentValues {
match alignment {
"center" | "middle" => HorizontalAlignmentValues::Center,
"left" => HorizontalAlignmentValues::Left,
"right" => HorizontalAlignmentValues::Right,
"justify" => HorizontalAlignmentValues::Justify,
"distributed" => HorizontalAlignmentValues::Distributed,
"fill" => HorizontalAlignmentValues::Fill,
"centerContinuous" => HorizontalAlignmentValues::CenterContinuous,
"general" | _ => HorizontalAlignmentValues::General,
}
}
pub fn parse_vertical_alignment(alignment: &str) -> VerticalAlignmentValues {
match alignment {
"center" | "middle" => VerticalAlignmentValues::Center,
"top" => VerticalAlignmentValues::Top,
"bottom" => VerticalAlignmentValues::Bottom,
"justify" => VerticalAlignmentValues::Justify,
"distributed" => VerticalAlignmentValues::Distributed,
_ => VerticalAlignmentValues::Bottom,
}
}