Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bokuweb committed Mar 25, 2024
1 parent f68a98c commit c7374cf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docx-core/src/documents/elements/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Table {
}

pub fn position(mut self, p: TablePositionProperty) -> Self {
self.property = self.property.position_property(p);
self.property = self.property.position(p);
self
}

Expand Down
10 changes: 5 additions & 5 deletions docx-core/src/documents/elements/table_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct TableProperty {
#[serde(skip_serializing_if = "Option::is_none")]
layout: Option<TableLayout>,
#[serde(skip_serializing_if = "Option::is_none")]
position_property: Option<TablePositionProperty>,
position: Option<TablePositionProperty>,
}

impl Default for TableProperty {
Expand All @@ -36,7 +36,7 @@ impl Default for TableProperty {
indent: None,
style: None,
layout: None,
position_property: None,
position: None,
}
}
}
Expand Down Expand Up @@ -143,8 +143,8 @@ impl TableProperty {
self
}

pub fn position_property(mut self, p: TablePositionProperty) -> Self {
self.position_property = Some(p);
pub fn position(mut self, p: TablePositionProperty) -> Self {
self.position = Some(p);
self
}
}
Expand All @@ -160,7 +160,7 @@ impl BuildXML for TableProperty {
.add_optional_child(&self.indent)
.add_optional_child(&self.style)
.add_optional_child(&self.layout)
.add_optional_child(&self.position_property)
.add_optional_child(&self.position)
.close()
.build()
}
Expand Down
2 changes: 1 addition & 1 deletion docx-core/src/reader/table_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl ElementReader for TableProperty {
}
XMLElement::TablePositionProperty => {
if let Ok(p) = TablePositionProperty::read(r, &attributes) {
tp = tp.position_property(p);
tp = tp.position(p);
}
}
_ => {}
Expand Down
5 changes: 5 additions & 0 deletions docx-wasm/js/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ export class Table {
return this;
}

position(p: TablePosition) {
this.property.position = p;
return this;
}

build() {
let table = wasm.createTable();
this.rows.forEach((r) => {
Expand Down
2 changes: 1 addition & 1 deletion docx-wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docx-wasm",
"version": "0.4.12-beta16",
"version": "0.4.12-beta17",
"main": "dist/node/index.js",
"browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>",
Expand Down
2 changes: 1 addition & 1 deletion docx-wasm/test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12507,7 +12507,7 @@ Object {
},
},
"justification": "left",
"positionProperty": Object {
"position": Object {
"horizontalAnchor": "margin",
"leftFromText": 142,
"positionY": 1118,
Expand Down

0 comments on commit c7374cf

Please sign in to comment.