跳到主要内容

InchesToPoints

Converts inches to points.

Syntax

expression.InchesToPoints(inches);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
inchesRequirednumberThe number of inches to convert to points.

Returns

number

Example

This example shows how to convert inches to points.

const inches = 100;
const points = Api.InchesToPoints(inches);

const rgb = Api.CreateRGBColor(50, 150, 250);
const fill = Api.CreateSolidFill(rgb);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', 300 * 36000, 150 * 36000, fill, stroke);
const paragraph = shape.GetContent().GetElement(0);
paragraph.AddText(inches + ' inches are equal to ' + points + ' points.');

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
slide.AddObject(shape);