Skip to main content

SetTopMargin

Sets the top margin of the sheet.

Syntax

expression.SetTopMargin(nPoints);

expression - A variable that represents a ApiWorksheet class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPointsRequirednumberThe top margin size measured in points.

Returns

boolean

Example

Set the top margin width for printed pages in a spreadsheet.

// How do I control the empty space along the top edge when printing in a spreadsheet?

// Determine how much blank space appears between the top page boundary and your data in a spreadsheet.

let worksheet = Api.GetActiveSheet();
worksheet.SetTopMargin(25.1);
let topMargin = worksheet.GetTopMargin();
worksheet.GetRange("A1").SetValue("Top margin: " + topMargin + " mm");