правки по имеющимся классам/методам таблиц и текстовых документов
This commit is contained in:
parent
35ae445df5
commit
28b1a9d29f
@ -33,22 +33,32 @@
|
||||
<cc:localizecontent runat="Server" controlname="~/Controls/Help/VariousControls/CopyCodeButton/CopyCodeButton.ascx" />
|
||||
<pre class="prettyprint source linenums"><code>builder.CreateFile("xlsx");
|
||||
var oWorksheet = Api.GetActiveSheet();
|
||||
var oStroke, oFill, oParagraph, oParaPr;
|
||||
var oStroke, oFill, oParagraph;
|
||||
oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
|
||||
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
|
||||
var oShape = oWorksheet.AddShape("flowChartOnlineStorage", 200 * 36000, 60 * 36000, oFill, oStroke, 0, 2 * 36000, 0, 3 * 36000);
|
||||
oDocContent = oShape.GetDocContent();
|
||||
oParagraph = oDocContent.GetElement(0);
|
||||
oParaPr = oParagraph.GetParaPr();
|
||||
oParaPr.SetJc("center");
|
||||
oParagraph.AddText("This is a paragraph with the text in it aligned by the center. ");
|
||||
oParagraph.AddText("The justification is specified in the paragraph style. ");
|
||||
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
|
||||
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes.");
|
||||
oParagraph.SetJc("center");
|
||||
oParagraph = Api.CreateParagraph();
|
||||
oParagraph.AddText("This is a paragraph with the text in it aligned by the right side. ");
|
||||
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
|
||||
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes.");
|
||||
oParagraph.SetJc("right");
|
||||
oDocContent.Push(oParagraph);
|
||||
oParagraph = Api.CreateParagraph();
|
||||
oParagraph.AddText("This is a paragraph with the text in it aligned by the left side. ");
|
||||
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
|
||||
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes.");
|
||||
oParagraph.SetJc("left");
|
||||
oDocContent.Push(oParagraph);
|
||||
builder.SaveFile("xlsx", "ApiParagraph.xlsx");
|
||||
builder.CloseFile();</code></pre>
|
||||
<h5>Resulting document</h5>
|
||||
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=5006309&doc=bTg2TWhpdk1BN2kvcGI1M3N4dEtpMTYvYnA3OFJnb1BxOWVnc0Jja3VYUT0_IjUwMDYzMDki0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
|
||||
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=5006331&doc=VlErZ2RCTVl0blY1d3FVWHVPV1RHNTZteTJZUjhrOTcxeWdtZE1aZ3BCOD0_IjUwMDYzMzEi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
@ -32,7 +32,7 @@ oTextPr.SetFontSize(30);
|
||||
oParagraph.SetJc("left");
|
||||
oRun.AddText("This is a sample text inside the shape with the font size set to 15 points using the text properties.");
|
||||
oParagraph.AddElement(oRun);
|
||||
builder.SaveFile("xlsx", "SetFontSize.xlsx");
|
||||
builder.SaveFile("xlsx", "GetTextPr.xlsx");
|
||||
builder.CloseFile();</code></pre>
|
||||
<h5>Resulting document</h5>
|
||||
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=5006256&doc=Wk12YzJhcEJLMnM5YWZ3dldXdUozTHM0bFhCTUc4TlhJL2pFbzVydUtwQT0_IjUwMDYyNTYi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
|
||||
|
@ -31,7 +31,7 @@ oTextPr = oRun.GetTextPr();
|
||||
oTextPr.SetFontSize(30);
|
||||
oTextPr.SetStrikeout(true);
|
||||
oParagraph.SetJc("left");
|
||||
oRun.AddText("This is an struck out text inside the shape.");
|
||||
oRun.AddText("This is a struck out text inside the shape.");
|
||||
oParagraph.AddElement(oRun);
|
||||
builder.SaveFile("xlsx", "SetStrikeout.xlsx");
|
||||
builder.CloseFile();</code></pre>
|
||||
|
@ -98,6 +98,6 @@ oWorksheet.SetColumnWidth(0, 20); // set the width of the first c
|
||||
oWorksheet.GetRange("A1").SetValue("New cell"); // set the 'New cell' value to the A1 spreadsheet cell
|
||||
builder.SaveFile("xlsx", "example.xlsx"); // save the resulting spreadsheet as a file in the .xlsx format with a new 'example.xlsx' name
|
||||
builder.CloseFile(); // close the spreadsheet file and finish work with ONLYOFFICE Document Builder</code></pre>
|
||||
<p>As you can see you just need to use the <code>builder.OpenFile();</code> method of the <span class="param-type"><a href="<%=VirtualPathUtility.ToAbsolute("~/developers/document-builder/integration/CDocBuilder/index.aspx")%>">CDocBuilder</a></span> class with the path to the necessary spreadsheet as an argument to open it. In the above example we open <b>myspreadsheet.docx</b> spreadsheet, get its first sheet and change the sheet name, first column width and enter the new value into its A1 cell. The same way any other myspreadsheet element can be changed.</p>
|
||||
<p>As you can see you just need to use the <code>builder.OpenFile();</code> method of the <span class="param-type"><a href="<%=VirtualPathUtility.ToAbsolute("~/developers/document-builder/integration/CDocBuilder/index.aspx")%>">CDocBuilder</a></span> class with the path to the necessary spreadsheet as an argument to open it. In the above example we open <b>myspreadsheet.xlsx</b> spreadsheet, get its first sheet and change the sheet name, first column width and enter the new value into its A1 cell. The same way any other spreadsheet element can be changed.</p>
|
||||
<p>Use the appropriate API documentation sections to find out which methods allow you to change certain document and spreadsheet element formatting properties.</p>
|
||||
</div>
|
@ -35,7 +35,7 @@ oDocContent.Push(oParagraph);
|
||||
builder.SaveFile("docx", "GetDocContent.docx");
|
||||
builder.CloseFile();</code></pre>
|
||||
<h5>Resulting document</h5>
|
||||
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=4887294&doc=ZHBFa1B2TjRGZTR6cjJFKytxbWZzd01CYm42R0oyQ3B1VXNPUEFmNVFOcz0_IjQ4ODcyOTQi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
|
||||
<iframe src="https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=4911012&doc=cFdPdXFmK2w3aENMaDB3NU1ZRTh2enJ2UTFDdDRlRURISStuYTRrb01IWT0_IjQ5MTEwMTIi0&action=embedded" frameborder="0" scrolling="no" allowtransparency></iframe>
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user