Skip to content

Commit

Permalink
Merge branch 'feature/api_stroke_to_json' of https://github.com/ONLYO…
Browse files Browse the repository at this point in the history
…FFICE/doc-builder-testing into feature/api_stroke_to_json
  • Loading branch information
Yar04ek committed Dec 7, 2023
2 parents ab6a8f3 + 8e937e7 commit f37eee1
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions js/docx/smoke/api_stroke/to_json.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
builder.CreateFile("docx");
let oDocument = Api.GetDocument();
let oParagraph = oDocument.GetElement(0);
let oRGBColor = Api.CreateRGBColor(255, 111, 61);
let oStroke = Api.CreateStroke(5 * 36000, Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51)));
let jsonStroke = oStroke.ToJSON();
oParagraph.AddText(jsonStroke);
GlobalVariable["JSON_Stroke"] = jsonStroke;
let oDocument = Api.GetDocument();
let oParagraph = oDocument.GetElement(0);
let oRGBColor = Api.CreateRGBColor(255, 111, 61);
let oStroke = Api.CreateStroke(5 * 36000, Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51)));
let jsonStroke = oStroke.ToJSON();
oParagraph.AddText(jsonStroke);
GlobalVariable["JSON_Stroke"] = jsonStroke;
builder.CloseFile();

//////////////////////

builder.CreateFile("docx");
let oDocument = Api.GetDocument();
let oParagraph1 = oDocument.GetElement(0);
let jsonStroke = GlobalVariable["JSON_Stroke"];
let oStrokeFromJSON = Api.FromJSON(jsonStroke);
let oRGBColor2 = Api.CreateRGBColor(255, 213, 191);
let oFill = Api.CreateSolidFill(oRGBColor2);
let oDrawing = Api.CreateShape("roundRect", 5930900, 395605, oFill, oStrokeFromJSON);
let jsonDrawing = oDrawing.ToJSON(false, true);
oParagraph1.AddDrawing(oDrawing);
oDocument.Push(oParagraph1);
let oParagraph2 = Api.CreateParagraph();
oParagraph2.AddText(jsonDrawing);
oDocument.Push(oParagraph2);
let oDocument = Api.GetDocument();
let oParagraph1 = oDocument.GetElement(0);
let jsonStroke = GlobalVariable["JSON_Stroke"];
let oStrokeFromJSON = Api.FromJSON(jsonStroke);
let oRGBColor2 = Api.CreateRGBColor(255, 213, 191);
let oFill = Api.CreateSolidFill(oRGBColor2);
let oDrawing = Api.CreateShape("roundRect", 5930900, 395605, oFill, oStrokeFromJSON);
let jsonDrawing = oDrawing.ToJSON(false, true);
oParagraph1.AddDrawing(oDrawing);
oDocument.Push(oParagraph1);
let oParagraph2 = Api.CreateParagraph();
oParagraph2.AddText(jsonDrawing);
oDocument.Push(oParagraph2);
builder.SaveFile("docx", "StrokeToJson.docx");
builder.CloseFile();

0 comments on commit f37eee1

Please sign in to comment.