Skip to main content

SetWidth

Specifies the preferred width for this cell.

Syntax​

expression.SetWidth(sType, nValue);

expression - A variable that represents an ApiTableCell class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
sTypeRequiredTableWidthThe type of the width value.
nValueOptionalnumberThe table width value measured in positive integers.

Returns​

boolean

Example​

Set a preferred width on individual table cells in a PDF.

// Give specific cells a fixed width in a PDF table.

// Create a table and set the first column cells width in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const table = Api.CreateTable(3, 3);
for (let r = 0; r < 3; r++) {
table.GetRow(r).GetCell(0).SetWidth('twips', 5660);
}

page.AddObject(table);