Get Started
Documentation

SetPaddings

SetPaddings(nLeft, nTop, nRight, nBottom)

Set text paddings

Parameters:

Name Type Description
nLeft EMU
nTop EMU
nRight EMU
nBottom EMU

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oDrawing = Api.CreateShape("rect", 3212465, 963295, oFill, oStroke);
oParagraph.AddDrawing(oDrawing);
var oDocContent = oDrawing.GetDocContent();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a sample text with paddings set to it: left = 5 * 36000, top = 1 * 36000, right = 10 * 36000, bottom = 2 * 36000.");
oDocContent.Push(oParagraph);
oDrawing.SetPaddings(5 * 36000, 1 * 36000, 10 * 36000, 2 * 36000);
builder.SaveFile("docx", "SetPaddings.docx");
builder.CloseFile();

Resulting document