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 TableRow(docx_rs::TableRow);
|
2019-12-11 07:12:22 +02:00
|
|
|
|
|
|
|
|
#[wasm_bindgen(js_name = createTableRow)]
|
|
|
|
|
pub fn create_table_row() -> TableRow {
|
2020-01-24 12:44:43 +02:00
|
|
|
TableRow(docx_rs::TableRow::new(vec![]))
|
2019-12-11 07:12:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl TableRow {
|
2020-01-24 12:44:43 +02:00
|
|
|
pub fn take(self) -> docx_rs::TableRow {
|
2019-12-11 07:12:22 +02:00
|
|
|
self.0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
|
impl TableRow {
|
|
|
|
|
pub fn add_cell(mut self, cell: TableCell) -> TableRow {
|
2022-01-25 15:12:45 +02:00
|
|
|
self.0
|
|
|
|
|
.cells
|
|
|
|
|
.push(docx_rs::TableRowChild::TableCell(cell.take()));
|
2019-12-11 07:12:22 +02:00
|
|
|
self
|
|
|
|
|
}
|
2020-10-13 10:27:03 +03:00
|
|
|
|
|
|
|
|
pub fn row_height(mut self, h: u32) -> TableRow {
|
|
|
|
|
self.0 = self.0.row_height(h as f32);
|
|
|
|
|
self
|
|
|
|
|
}
|
2021-03-02 05:31:46 +02:00
|
|
|
|
|
|
|
|
pub fn height_rule(mut self, r: docx_rs::HeightRule) -> TableRow {
|
|
|
|
|
self.0 = self.0.height_rule(r);
|
|
|
|
|
self
|
|
|
|
|
}
|
2022-01-25 15:12:45 +02:00
|
|
|
|
|
|
|
|
pub fn delete(mut self, author: &str, date: &str) -> Self {
|
|
|
|
|
self.0 = self
|
|
|
|
|
.0
|
|
|
|
|
.delete(docx_rs::Delete::new().author(author).date(date));
|
|
|
|
|
self
|
|
|
|
|
}
|
2022-02-04 11:37:04 +02:00
|
|
|
|
|
|
|
|
pub fn insert(mut self, author: &str, date: &str) -> Self {
|
|
|
|
|
self.0 = self
|
|
|
|
|
.0
|
|
|
|
|
.insert(docx_rs::Insert::new_with_empty().author(author).date(date));
|
|
|
|
|
self
|
|
|
|
|
}
|
2019-12-11 07:12:22 +02:00
|
|
|
}
|