Skip to content

Commit

Permalink
ref: ApiTableRowPr.ToJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Yar04ek committed Dec 15, 2023
1 parent b168de4 commit ecbfa8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions js/docx/smoke/api_table_row_pr/to_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ builder.CreateFile("docx");
let oDocument = Api.GetDocument();
let oParagraph = oDocument.GetElement(0);
let jsonTableStyle = GlobalVariable["JSON_TableStyle"];
oParagraph.AddText(jsonTableStyle);
let oTableStyle = oDocument.GetStyle("My Custom Table Style");
let oTableStyle = Api.FromJSON(jsonTableStyle);
let oTable = Api.CreateTable(3, 3);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
let jsonTable = oTableStyle.ToJSON();
let oParagraph2 = Api.CreateParagraph();
oDocument.Push(oParagraph2);
oParagraph2.AddText(jsonTable);
oDocument.Push(oParagraph2);
builder.SaveFile("docx", "TableStyleToJSON.docx");
builder.CloseFile();
2 changes: 1 addition & 1 deletion spec/docx/smoke/api_table_row_properties_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

it 'ApiTableRowPr | ToJson method' do
docx = builder.build_and_parse('js/docx/smoke/api_table_row_pr/to_json.js')
json = docx.elements[0].nonempty_runs.map(&:text).join
json = docx.elements[1].nonempty_runs.map(&:text).join
parsed_json = JSON.parse(json)
expect(parsed_json).to include('name' => 'My Custom Table Style')
end
Expand Down

0 comments on commit ecbfa8d

Please sign in to comment.