Api
Base class
Methods
Name |
Description |
AddComment |
Adds a comment to the desired element or array of elements. |
CreateBlipFill |
Create a blip fill which allows to fill the object using a selected image as the object background. |
CreateBlockLvlSdt |
Create a new block level container |
CreateBullet |
Create a bullet for a paragraph with the character or symbol specified with the sBullet parameter. |
CreateChart |
Create a chart with the parameters specified. |
CreateGradientStop |
Create a gradient stop used for different types of gradients. |
CreateHyperlink |
Create a new hyperlink text block to be inserted to the current paragraph or table. |
CreateImage |
Create an image with the parameters specified. |
CreateInlineLvlSdt |
Create a new inline container |
CreateLinearGradientFill |
Create a linear gradient fill which allows to fill the object using a selected linear gradient as the object background. |
CreateNoFill |
Create no fill and remove the fill from the element. |
CreateNumbering |
Create a bullet for a paragraph with the character or symbol specified with the sType parameter. |
CreateParagraph |
Create a new paragraph. |
CreatePatternFill |
Create a pattern fill which allows to fill the object using a selected pattern as the object background. |
CreatePresetColor |
Create a color selecting it from one of the available color presets. |
CreateRadialGradientFill |
Create a radial gradient fill which allows to fill the object using a selected radial gradient as the object background. |
CreateRange |
Create a new paragraph. |
CreateRGBColor |
Create an RGB color setting the appropriate values for the red, green and blue color components. |
CreateRun |
Create a new smaller text block to be inserted to the current paragraph or table. |
CreateSchemeColor |
Create a complex color scheme selecting from one of the available schemes. |
CreateShape |
Create a shape with the parameters specified. |
CreateSolidFill |
Create a solid fill which allows to fill the object using a selected solid color as the object background. |
CreateStroke |
Create a stroke adding shadows to the element. |
CreateTable |
Create a new table with a specified number of rows and columns. |
GetDocument |
Get the main document |
GetFirstRunInArray |
Get the Run that is first in position |
GetLastRunInArray |
Get the Run that is last in position |
GetMailMergeReceptionsCount |
Gets the mail merge template doc. |
GetMailMergeTemplateDocContent |
Gets the mail merge template doc. |
LoadMailMergeData |
Loads data for the mail merge. |
MailMerge |
Starts the mail merge process |
ReplaceDocumentContent |
Replaces the content of the main document with the another document content. |
Save |
Saves changes to the specified document. |
Example
Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oRun = Api.CreateRun();
oRun.AddText("This is an example for base class methods.");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(" A paragraph and a numbered list were created.");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(" Then a chart, a shape and a table were created. The result was saved to the document.");
oParagraph.AddElement(oRun);
oParagraph = Api.CreateParagraph();
oDrawing = Api.CreateChart("bar3D", [
[200, 240, 280],
[250, 260, 280]
], ["Projected Revenue", "Estimated Costs"], [2014, 2015, 2016], 4051300, 2347595, 24);
oParagraph.AddDrawing(oDrawing);
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 224, 204), 0);
oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 164, 101), 100000);
oFill = Api.CreateLinearGradientFill([oGs1, oGs2], 5400000);
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oDrawing = Api.CreateShape("rect", 5930900, 395605, oFill, oStroke);
oParagraph.AddDrawing(oDrawing);
oDocument.Push(oParagraph);
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
Api.Save();
builder.SaveFile("docx", "Api.docx");
builder.CloseFile();
Resulting document