From 1b3fc35c742b9ea4027f4ef0682be7e38906482c Mon Sep 17 00:00:00 2001 From: alexandervnuchkov Date: Tue, 11 Oct 2016 14:22:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80=D1=8B=20=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BF=D0=BE=20=D0=B1=D0=B8=D0=BB=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Help/Developers/Builder/Builder.ascx | 2 +- .../Presentation/Api/GetPresentation.ascx | 20 +++++++++-- .../ApiPresentation/GetSlideByIndex.ascx | 1 - .../Spreadsheet/Api/GetActiveSheet.ascx | 11 ++++++- .../Spreadsheet/ApiRange/ApiRange.ascx | 1 + .../TextDocument/ApiParagraph/GetElement.ascx | 33 ++++++++++--------- .../ApiTableRow/SetTableHeader.ascx | 2 +- .../ApiTableRowPr/SetTableHeader.ascx | 2 +- 8 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Web/Controls/Help/Developers/Builder/Builder.ascx b/Web/Controls/Help/Developers/Builder/Builder.ascx index 4a2005f07..8d67cc9be 100644 --- a/Web/Controls/Help/Developers/Builder/Builder.ascx +++ b/Web/Controls/Help/Developers/Builder/Builder.ascx @@ -18,7 +18,7 @@

ONLYOFFICE Document Builder is a C++ library used to create and edit Office Open XML format files (documents, spreadsheets and presentations) and save them to DOCX, XSLX, PPTX and PDF formats. You can integrate this library into your own presentation or use the provided executive binary wrapper for an easy start.

To launch ONLYOFFICE Document Builder run the following command:

docbuilder.exe mydocument.docbuilder
-

Here docbuilder.exe is the name of ONLYOFFICE Document Builder (together with the path, if the command is run from the folder different from where the executive is placed) executive file (it will look like docbuilder.exe for Windows version, docbuilder_linux64 for Linux and docbuilder_mac64 for Mac OS), and the mydocument.docbuilder parameter is the name (again, together with the path, if needed) of the script file that will form the document contents.

+

Here docbuilder.exe is the name of ONLYOFFICE Document Builder (together with the path, if the command is run from the folder different from where the executive is placed) executive file (it will look like docbuilder.exe for Windows version, documentbuilder for Linux and Mac OS), and the mydocument.docbuilder parameter is the name (again, together with the path, if needed) of the script file that will form the document contents.

Read the ">Integration section for more information on how to integrate ONLYOFFICE Document Builder into your own application.

Where to start?

If you are not sure where to start, you can use the list of most common tasks below to find where to go and start creating your document:

diff --git a/Web/Controls/Help/Developers/Builder/Presentation/Api/GetPresentation.ascx b/Web/Controls/Help/Developers/Builder/Presentation/Api/GetPresentation.ascx index 9d481b442..96132b5ba 100644 --- a/Web/Controls/Help/Developers/Builder/Presentation/Api/GetPresentation.ascx +++ b/Web/Controls/Help/Developers/Builder/Presentation/Api/GetPresentation.ascx @@ -30,9 +30,23 @@
Example
-
var oPresentation = Api.GetPresentation();
-<%--
Resulting document
- --%> +
builder.CreateFile("pptx");
+var oPresentation = Api.GetPresentation();
+var oSlide = oPresentation.GetSlideByIndex(0);
+oSlide.RemoveAllObjects();
+oChart = Api.CreateChart("bar3D", [[200, 240, 280],[250, 260, 280]], ["Projected Revenue", "Estimated Costs"], [2014, 2015, 2016], 4051300, 2347595, 24);
+oChart.SetVerAxisTitle("USD In Hundred Thousands", 10);
+oChart.SetHorAxisTitle("Year", 11);
+oChart.SetLegendPos("bottom");
+oChart.SetShowDataLabels(false, false, true);
+oChart.SetTitle("Financial Overview", 13);
+oChart.SetSize(300 * 36000, 130 * 36000);
+oChart.SetPosition(608400, 1267200);
+oSlide.AddObject(oChart);
+builder.SaveFile("pptx", "GetPresentation.pptx");
+builder.CloseFile();
+
Resulting document
+ \ No newline at end of file diff --git a/Web/Controls/Help/Developers/Builder/Presentation/ApiPresentation/GetSlideByIndex.ascx b/Web/Controls/Help/Developers/Builder/Presentation/ApiPresentation/GetSlideByIndex.ascx index eb1baf26d..e90170992 100644 --- a/Web/Controls/Help/Developers/Builder/Presentation/ApiPresentation/GetSlideByIndex.ascx +++ b/Web/Controls/Help/Developers/Builder/Presentation/ApiPresentation/GetSlideByIndex.ascx @@ -56,7 +56,6 @@ oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 224, 204), 0); oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 164, 101), 100000); oFill = Api.CreateRadialGradientFill([oGs1, oGs2]); oSlide.SetBackground(oFill); -oPresentation.AddSlide(oSlide); builder.SaveFile("pptx", "GetSlideByIndex.pptx"); builder.CloseFile();
Resulting document
diff --git a/Web/Controls/Help/Developers/Builder/Spreadsheet/Api/GetActiveSheet.ascx b/Web/Controls/Help/Developers/Builder/Spreadsheet/Api/GetActiveSheet.ascx index 32502dfe0..75290a898 100644 --- a/Web/Controls/Help/Developers/Builder/Spreadsheet/Api/GetActiveSheet.ascx +++ b/Web/Controls/Help/Developers/Builder/Spreadsheet/Api/GetActiveSheet.ascx @@ -30,7 +30,16 @@
Example
-
var oWorksheet = Api.GetActiveSheet();
+
builder.CreateFile("xlsx");
+var oWorksheet = Api.GetActiveSheet();
+oWorksheet.GetRange('B1').SetValue('2');
+oWorksheet.GetRange('B2').SetValue('2');
+oWorksheet.GetRange('A3').SetValue('2x2=');
+oWorksheet.GetRange('B3').SetValue('=B1*B2');
+builder.SaveFile("xlsx", "GetActiveSheet.xlsx");
+builder.CloseFile();
+
Resulting document
+ diff --git a/Web/Controls/Help/Developers/Builder/Spreadsheet/ApiRange/ApiRange.ascx b/Web/Controls/Help/Developers/Builder/Spreadsheet/ApiRange/ApiRange.ascx index 91993a0d3..54945151d 100644 --- a/Web/Controls/Help/Developers/Builder/Spreadsheet/ApiRange/ApiRange.ascx +++ b/Web/Controls/Help/Developers/Builder/Spreadsheet/ApiRange/ApiRange.ascx @@ -33,6 +33,7 @@ oWorksheet.GetRange('B1').SetValue('2'); oWorksheet.GetRange('B2').SetValue('2'); oWorksheet.GetRange('A3').SetValue('2x2='); oWorksheet.GetRange('B3').SetValue('=B1*B2'); +builder.SaveFile("xlsx", "ApiRange.xlsx"); builder.CloseFile();
Resulting document
diff --git a/Web/Controls/Help/Developers/Builder/TextDocument/ApiParagraph/GetElement.ascx b/Web/Controls/Help/Developers/Builder/TextDocument/ApiParagraph/GetElement.ascx index d09ee1485..44e3a3474 100644 --- a/Web/Controls/Help/Developers/Builder/TextDocument/ApiParagraph/GetElement.ascx +++ b/Web/Controls/Help/Developers/Builder/TextDocument/ApiParagraph/GetElement.ascx @@ -18,22 +18,23 @@
Example
-
builder.CreateFile("docx");
-var oDocument = Api.GetDocument();
-var oParagraph, oRun;
-oParagraph = oDocument.GetElement(0);
-oParagraph.RemoveAllElements();
-oRun = Api.CreateRun();
-oRun.AddText("This is the text for the first text run. Do not forget a space at its end to separate from the second one. ");
-oParagraph.AddElement(oRun);
-oRun = Api.CreateRun();
-oRun.AddText("This is the text for the second run. We will set it bold afterwards. It also needs space at its end. ");
-oParagraph.AddElement(oRun);
-oRun = Api.CreateRun();
-oRun.AddText("This is the text for the third run. It ends the paragraph.");
-oParagraph.AddElement(oRun);
-oRun = oParagraph.GetElement(1);
-oRun.SetBold(true);
+            
builder.CreateFile("docx");
+var oDocument = Api.GetDocument();
+var oParagraph, oRun;
+oParagraph = Api.CreateParagraph();
+oParagraph.RemoveAllElements();
+oRun = Api.CreateRun();
+oRun.AddText("This is the text for the first text run. Do not forget a space at its end to separate from the second one. ");
+oParagraph.AddElement(oRun);
+oRun = Api.CreateRun();
+oRun.AddText("This is the text for the second run. We will set it bold afterwards. It also needs space at its end. ");
+oParagraph.AddElement(oRun);
+oRun = Api.CreateRun();
+oRun.AddText("This is the text for the third run. It ends the paragraph.");
+oParagraph.AddElement(oRun);
+oRun = oParagraph.GetElement(1);
+oRun.SetBold(true);
+oDocument.Push(oParagraph);
 builder.SaveFile("docx", "GetElement.docx");
 builder.CloseFile();
Resulting document
diff --git a/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRow/SetTableHeader.ascx b/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRow/SetTableHeader.ascx index 56f233a34..4bbc6fc98 100644 --- a/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRow/SetTableHeader.ascx +++ b/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRow/SetTableHeader.ascx @@ -52,7 +52,7 @@ var oDocument = Api.GetDocument(); var oParagraph, oTable, oTableStyle, oCell, oTableRow; oParagraph = oDocument.GetElement(0); -oParagraph.AddText("We create a 3x3 table and set row #1 as the table header:"); +oParagraph.AddText("We create a 3x90 table and set row #1 as the table header:"); oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table"); oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5")); oTable = Api.CreateTable(3, 90); diff --git a/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRowPr/SetTableHeader.ascx b/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRowPr/SetTableHeader.ascx index 7b02171d5..8af6298ee 100644 --- a/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRowPr/SetTableHeader.ascx +++ b/Web/Controls/Help/Developers/Builder/TextDocument/ApiTableRowPr/SetTableHeader.ascx @@ -18,7 +18,7 @@

SetTableHeader(isHeader)

- Specify that the current table row will be repeated at the top of each new page wherever this table is displayed. This gives this table row the behavior of a 'header' row on each of these pages. This element can be applied to any number of rows at the top of the table structure in order to generate multi-row table headers. + Specify that all the current table rows will be styled as its header row.
Parameters: