2019-12-11 07:12:22 +02:00
|
|
|
use super::*;
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
#[derive(Debug)]
|
2020-01-24 12:44:43 +02:00
|
|
|
pub struct TableCell(docx_rs::TableCell);
|
2019-12-11 07:12:22 +02:00
|
|
|
|
|
|
|
#[wasm_bindgen(js_name = createTableCell)]
|
|
|
|
pub fn create_table_cell() -> TableCell {
|
2020-01-24 12:44:43 +02:00
|
|
|
TableCell(docx_rs::TableCell::new())
|
2019-12-11 07:12:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl TableCell {
|
2020-01-24 12:44:43 +02:00
|
|
|
pub fn take(self) -> docx_rs::TableCell {
|
2019-12-11 07:12:22 +02:00
|
|
|
self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
impl TableCell {
|
|
|
|
pub fn add_paragraph(mut self, p: Paragraph) -> TableCell {
|
|
|
|
self.0
|
2020-02-11 10:01:39 +02:00
|
|
|
.children
|
2020-01-24 12:44:43 +02:00
|
|
|
.push(docx_rs::TableCellContent::Paragraph(p.take()));
|
2019-12-11 07:12:22 +02:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-01-24 12:44:43 +02:00
|
|
|
pub fn vertical_merge(mut self, t: docx_rs::VMergeType) -> TableCell {
|
2019-12-11 07:12:22 +02:00
|
|
|
self.0.property = self.0.property.vertical_merge(t);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-03-19 18:19:39 +02:00
|
|
|
pub fn vertical_align(mut self, t: docx_rs::VAlignType) -> TableCell {
|
|
|
|
self.0.property = self.0.property.vertical_align(t);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2019-12-11 07:12:22 +02:00
|
|
|
pub fn grid_span(mut self, v: usize) -> TableCell {
|
|
|
|
self.0.property = self.0.property.grid_span(v);
|
|
|
|
self
|
|
|
|
}
|
2019-12-16 18:57:56 +02:00
|
|
|
|
|
|
|
pub fn width(mut self, v: usize) -> TableCell {
|
2020-01-24 12:44:43 +02:00
|
|
|
self.0.property = self.0.property.width(v, docx_rs::WidthType::DXA);
|
2019-12-16 18:57:56 +02:00
|
|
|
self
|
|
|
|
}
|
2020-04-27 04:41:23 +03:00
|
|
|
|
2021-03-03 03:35:50 +02:00
|
|
|
pub fn text_direction(mut self, t: docx_rs::TextDirectionType) -> TableCell {
|
|
|
|
self.0.property = self.0.property.text_direction(t);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-04-27 04:41:23 +03:00
|
|
|
pub fn set_border(mut self, border: TableCellBorder) -> TableCell {
|
|
|
|
self.0.property = self.0.property.set_border(border.take());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn clear_border(mut self, position: docx_rs::BorderPosition) -> TableCell {
|
|
|
|
self.0.property = self.0.property.clear_border(position);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn clear_all_border(mut self) -> TableCell {
|
|
|
|
self.0.property = self.0.property.clear_all_border();
|
|
|
|
self
|
|
|
|
}
|
2019-12-11 07:12:22 +02:00
|
|
|
}
|