-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
builder.CreateFile("docx"); | ||
var oDocument = Api.GetDocument(); | ||
var oParagraph, oRGBColor; | ||
|
||
// Создаем элемент параграфа | ||
oParagraph = Api.CreateParagraph(); | ||
|
||
// Создаем RGB цвет с помощью значений RGB (красный, зеленый, синий) | ||
oRGBColor = Api.CreateRGBColor(255, 0, 0); // Например, красный цвет | ||
|
||
// Преобразуем RGB цвет в JSON | ||
var jsonRGB = oRGBColor.ToJSON(); | ||
|
||
// Добавляем текстовую строку с JSON представлением RGB цвета в параграф | ||
oParagraph.AddText("JSON representation of RGB color: " + jsonRGB); | ||
|
||
// Добавляем созданный параграф в документ | ||
var oParagraph = Api.CreateParagraph(); | ||
var oRGBColor = Api.CreateRGBColor(255, 0, 0); | ||
var json = oRGBColor.ToJSON(); | ||
oParagraph.AddText("JSON representation of RGB color: " + json); | ||
oDocument.Push(oParagraph); | ||
GlobalVariable["RGBColorJSON"] = json; | ||
builder.CloseFile() | ||
///////////////////////// | ||
|
||
// Сохраняем файл | ||
builder.SaveFile("docx", "RGBColorJSONCheck.docx"); | ||
builder.CreateFile("docx"); | ||
var oDocument = Api.GetDocument(); | ||
var oParagraph = oDocument.GetElement(0); | ||
var json = GlobalVariable["RGBColorJSON"]; | ||
var oRGBColorFromJSON = Api.FromJSON(json); | ||
oRGBColorFromJSON.SetDefaultStyle(); | ||
oParagraph.AddElement(oRGBColorFromJSON); | ||
var oParagraph1 = Api.CreateParagraph(); | ||
oDocument.Push(oParagraph1); | ||
oParagraph1.AddText(json); | ||
builder.SaveFile("docx", "RGBColorDocument.docx"); | ||
builder.CloseFile(); | ||
|
||
|
||
|
||
///////////////////////// | ||
|
||
builder.CreateFile("docx"); | ||
var oDocument = Api.GetDocument(); | ||
var oRGBColor = Api.CreateRGBColor(255, 164, 101); | ||
var json = oRGBColor.ToJSON(); | ||
GlobalVariable["RGBColorJSON"] = json; | ||
var oParagraph = Api.CreateParagraph(); | ||
oParagraph.AddText("JSON representation of RGBColor: " + json); | ||
oDocument.Push(oParagraph); | ||
builder.SaveFile("docx", "RGBColorToJSON.docx"); | ||
builder.CloseFile(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters