umya_spreadsheet/structs/
vertical_text_alignment.rs1use std::io::Cursor;
3
4use quick_xml::{
5 Reader,
6 Writer,
7 events::BytesStart,
8};
9
10use super::{
11 EnumValue,
12 VerticalAlignmentRunValues,
13};
14use crate::{
15 reader::driver::{
16 get_attribute,
17 set_string_from_xml,
18 },
19 writer::driver::write_start_tag,
20};
21
22#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd)]
23pub struct VerticalTextAlignment {
24 pub(crate) val: EnumValue<VerticalAlignmentRunValues>,
25}
26
27impl VerticalTextAlignment {
28 #[inline]
29 #[must_use]
30 pub fn val(&self) -> &VerticalAlignmentRunValues {
31 self.val.value()
32 }
33
34 #[inline]
35 #[must_use]
36 #[deprecated(since = "3.0.0", note = "Use val()")]
37 pub fn get_val(&self) -> &VerticalAlignmentRunValues {
38 self.val()
39 }
40
41 #[inline]
42 pub fn set_val(&mut self, value: VerticalAlignmentRunValues) -> &mut Self {
43 self.val.set_value(value);
44 self
45 }
46
47 #[inline]
48 pub(crate) fn set_attributes<R: std::io::BufRead>(
49 &mut self,
50 _reader: &mut Reader<R>,
51 e: &BytesStart,
52 ) {
53 set_string_from_xml!(self, e, val, "val");
54 }
55
56 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
57 if self.val.has_value() {
59 write_start_tag(
60 writer,
61 "vertAlign",
62 vec![("val", self.val.value_string()).into()],
63 true,
64 );
65 }
66 }
67}