content: Value,
}
+impl From<&Diagnostic> for Text {
+ fn from(value: &Diagnostic) -> Self {
+ Text {
+ type_: TextType::Log,
+ content: Value::new_user_text(value.to_string()),
+ }
+ }
+}
+
pub enum TextType {
/// `TITLE` and `SUBTITLE` commands.
PageTitle,
TextType::Log => "Log",
}
}
+
+ pub fn as_xml_str(&self) -> &'static str {
+ match self {
+ TextType::PageTitle => "page-title",
+ TextType::Title => "title",
+ TextType::Syntax | TextType::Log => "log",
+ }
+ }
}
pub struct ItemCursor {
Footnotes, Group, HeadingRegion, HorzAlign, LabelPosition, Leaf, PivotTable,
RowColBorder, Stroke, Value, ValueInner, ValueStyle, VertAlign,
},
- Item,
+ Item, Text,
},
settings::Show,
};
let mut content = Vec::new();
let mut cursor = Cursor::new(&mut content);
pivot_table.write_le(&mut cursor).unwrap();
- println!("{}", content.len());
let table_name = light_table_name(table_id);
self.writer
});
}
+ fn write_text<X>(&mut self, item: &Item, text: &Text, structure: &mut XmlWriter<X>)
+ where
+ X: Write,
+ {
+ self.container(structure, item, "vtx:text", |w| {
+ w.with_attribute(("type", text.type_.as_xml_str()))
+ .write_text_content(BytesText::new(&text.content.display(()).to_string()))
+ .unwrap();
+ });
+ }
+
fn write_item<X>(&mut self, item: &Item, structure: &mut XmlWriter<X>)
where
X: Write,
})
.unwrap();
}
- super::Details::Message(_diagnostic) => todo!(),
+ super::Details::Message(diagnostic) => {
+ self.write_text(item, &diagnostic.into(), structure)
+ }
super::Details::PageBreak => {
self.needs_page_break = true;
}
super::Details::Table(pivot_table) => self.write_table(&*item, pivot_table, structure),
- super::Details::Text(_text) => todo!(),
+ super::Details::Text(text) => self.write_text(item, text, structure),
}
}