Get Started
Usage API

SetPosition

SetPosition(nPosition) → { ApiTextPr }

Specify the amount by which text is raised or lowered for this run in relation to the default baseline of the surrounding non-positioned text.

Parameters:

Name Type Description
nPosition hps

Specifies a positive (raised text) or negative (lowered text) measurement in half-points (1/144 of an inch).

Returns:

Type
ApiTextPr

Example

Copy code
builder.CreateFile("pptx");
oPresentation = Api.GetPresentation();
oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oShape = Api.CreateShape("rect", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oRun = Api.CreateRun();
oRun.AddText("This is a text run with the text raised 10 half-points.");
oParagraph.AddElement(oRun);
oRun.SetPosition(10);
oRun = Api.CreateRun();
oRun.AddText("This is a text run with the text lowered 16 half-points.");
oParagraph.AddElement(oRun);
oRun.SetPosition(-16);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "SetPosition.pptx");
builder.CloseFile();

Resulting document