поправил примеры в документации по билдеру

This commit is contained in:
alexandervnuchkov 2016-10-11 14:22:14 +03:00
parent 32e896555b
commit 1b3fc35c74
8 changed files with 48 additions and 24 deletions

View File

@ -18,7 +18,7 @@
<p><b>ONLYOFFICE Document Builder</b> 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.</p>
<p>To launch <b>ONLYOFFICE Document Builder</b> run the following command:</p>
<pre class="prettyprint source"><code>docbuilder.exe mydocument.docbuilder</code></pre>
<p>Here <b>docbuilder.exe</b> is the name of <b>ONLYOFFICE Document Builder</b> (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 <b>docbuilder.exe</b> for Windows version, <b>docbuilder_linux64</b> for Linux and <b>docbuilder_mac64</b> for Mac OS), and the <b>mydocument.docbuilder</b> parameter is the name (again, together with the path, if needed) of the script file that will form the document contents.</p>
<p>Here <b>docbuilder.exe</b> is the name of <b>ONLYOFFICE Document Builder</b> (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 <b>docbuilder.exe</b> for Windows version, <b>documentbuilder</b> for Linux and Mac OS), and the <b>mydocument.docbuilder</b> parameter is the name (again, together with the path, if needed) of the script file that will form the document contents.</p>
<p>Read the <a href="<%=VirtualPathUtility.ToAbsolute("~/developers/document-builder/integration/CDocBuilder/index.aspx")%>">Integration</a> section for more information on how to integrate <b>ONLYOFFICE Document Builder</b> into your own application.</p>
<h2 id="WhereStart">Where to start?</h2>
<p>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:</p>

View File

@ -30,9 +30,23 @@
</dl>
<h5>Example</h5>
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/VariousControls/CopyCodeButton/CopyCodeButton.ascx" />
<pre class="prettyprint source linenums"><code>var oPresentation = Api.GetPresentation();</code></pre>
<%-- <h5>Resulting document</h5>
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=4883384&doc=eVFmVDdLbkFZNHh5RkEwU3d5cFQwdXhnYjVFcHRGUjVYbHRNOUs1a1BXdz0_IjQ4ODMzODQi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>--%>
<pre class="prettyprint source linenums"><code>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();</code></pre>
<h5>Resulting document</h5>
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=5007723&doc=SnZ2UnlZNS9WOEF6YzFYeURzdTNpSi9nWS9oTjcwSS9OQ3ZWQXJOUS9Cbz0_IjUwMDc3MjMi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
</article>
</section>
</div>

View File

@ -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();</code></pre>
<h5>Resulting document</h5>

View File

@ -30,7 +30,16 @@
</dl>
<h5>Example</h5>
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/VariousControls/CopyCodeButton/CopyCodeButton.ascx" />
<pre class="prettyprint source linenums"><code>var oWorksheet = Api.GetActiveSheet();</code></pre>
<pre class="prettyprint source linenums"><code>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();</code></pre>
<h5>Resulting document</h5>
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=4882026&doc=M3ZjUVlCZE11Z09QVi9MV0tSeEVKbTRwRmVqTit4LzFWMGkxRFA4SkJnRT0_IjQ4ODIwMjYi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
</article>
</section>
</div>

View File

@ -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();</code></pre>
<h5>Resulting document</h5>
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=4882026&doc=M3ZjUVlCZE11Z09QVi9MV0tSeEVKbTRwRmVqTit4LzFWMGkxRFA4SkJnRT0_IjQ4ODIwMjYi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>

View File

@ -18,22 +18,23 @@
<cc:localizecontent runat="Server" controlname="~/Controls/Help/Developers/Builder/Common/ApiParagraph/GetElement.ascx" />
<h5>Example</h5>
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/VariousControls/CopyCodeButton/CopyCodeButton.ascx" />
<pre class="prettyprint source linenums"><code>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);
<pre class="prettyprint source linenums"><code>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();</code></pre>
<h5>Resulting document</h5>

View File

@ -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);

View File

@ -18,7 +18,7 @@
<div class="container-overview">
<h4 class="name" id="SetTableHeader"><span class="type-signature"></span>SetTableHeader<span class="signature">(isHeader)</span><span class="type-signature"></span></h4>
<div class="builder_description">
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.
</div>
</div>
<h5>Parameters:</h5>