Get Started
Documentation

SetVertAlign

SetVertAlign(sType)

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.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTextPr;
oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetVertAlign("subscript");
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("A sample text aligned below the baseline vertically.");
builder.SaveFile("docx", "SetVertAlign.docx");
builder.CloseFile();

Resulting document