SetVertAlign
Specify the alignment which will be applied to the contents of this run in relation to the default appearance of the run text:
- "baseline" - the characters in the current text run will be aligned by the default text baseline.
- "subscript" - the characters in the current text run will be aligned below the default text baseline.
- "superscript" - the characters in the current text run will be aligned above the default text baseline.
Parameters:
Name |
Type |
Description |
sType |
"baseline" | "subscript" | "superscript"
|
The vertical alignment type applied to the text contents. |
Returns:
-
This method doesn't return any data.
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", 120 * 36000, 70 * 36000, oFill, oStroke, 0, 2 * 36000, 0, 3 * 36000);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oRun = Api.CreateRun();
oTextPr = oRun.GetTextPr();
oTextPr.SetVertAlign("superscript");
oParagraph.SetJc("left");
oRun.AddText("This is a text inside the shape with vertical alignment set to 'superscript'.");
oParagraph.AddElement(oRun);
builder.SaveFile("xlsx", "SetVertAlign.xlsx");
builder.CloseFile();
Resulting document