ApiParagraph
Class representing a paragraph.
Methods
Name |
Description |
AddElement |
Add an element to the current paragraph. |
AddLineBreak |
Add line break to the current position and start the next element from a new line. |
AddTabStop |
Add a tab stop to the current paragraph. |
AddText |
Add some text to the element. |
Copy |
Create a copy of the paragraph. Ingonore comments, footnote references, complex fields |
Delete |
Deletes current paragraph. |
GetClassType |
Get the type of this class. |
GetElement |
Get the element of the paragraph using the position specified. |
GetElementsCount |
Get the number of elements in the current paragraph. |
GetNext |
Gets the next paragraph. |
GetParaPr |
Get paragraph properties. |
GetPrevious |
Gets the Previous paragraph. |
RemoveAllElements |
Remove all elements from the current paragraph.
When all elements are removed from the paragraph, a new empty run is automatically created. If you want to add
content to this run, use the ApiParagraph.GetElement method. |
RemoveElement |
Remove the element using the position specified.
If the element you remove is the last paragraph element (i.e. all elements are removed from the paragraph),
a new empty run is automatically created. If you want to add
content to this run, use the ApiParagraph.GetElement method. |
SetBullet |
Set the bullet or numbering to the current paragraph. |
SetIndFirstLine |
Set the paragraph first line indentation. |
SetIndLeft |
Set the paragraph left side indentation. |
SetIndRight |
Set the paragraph right side indentation. |
SetJc |
Set paragraph contents justification. |
SetSpacingAfter |
Set the spacing after the current paragraph. If the value of the isAfterAuto parameter is true, then
any value of the nAfter is ignored. If isAfterAuto parameter is not specified, then it
will be interpreted as false. |
SetSpacingBefore |
Set the spacing before the current paragraph. If the value of the isBeforeAuto parameter is true, then
any value of the nBefore is ignored. If isBeforeAuto parameter is not specified, then
it will be interpreted as false. |
SetSpacingLine |
Set the paragraph line spacing. If the value of the sLineRule parameter is either
"atLeast" or "exact", then the value of nLine will be interpreted as twentieths of a point. If
the value of the sLineRule parameter is "auto", then the value of the
nLine parameter will be interpreted as 240ths of a line. |
SetTabs |
Specify a sequence of custom tab stops which will be used for any tab characters in the current paragraph.
Warning: The lengths of aPos array and aVal array MUST BE equal to each other. |
Example
Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oShape = oWorksheet.AddShape("flowChartOnlineStorage", 200 * 36000, 60 * 36000, oFill, oStroke, 0, 2 * 36000, 0, 3 * 36000);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is a paragraph with the text in it aligned by the center. ");
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();
Resulting document