How to convert inches to points in .NET Excel Library

16 Aug 20261 minute to read

Converting measurements between units is common when laying out Excel content programmatically. Syncfusion XlsIO exposes an InchesToPoints helper on the IApplication instance that converts a measurement in inches to points.

The following code example illustrates the conversion.

// Create an instance of ExcelEngine
using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;

    // Converts inches to points
    double inches = 4.5;
    double points = application.InchesToPoints(inches);
    Console.WriteLine($"{inches} inches is equal to {points} points.");
}
// Create an instance of ExcelEngine
using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;

    // Converts inches to points
    double inches = 4.5;
    double points = application.InchesToPoints(inches);
    Console.WriteLine($"{inches} inches is equal to {points} points.");
}
Using excelEngine As New ExcelEngine()
    Dim application As IApplication = excelEngine.Excel

    ' Converts inches to points
    Dim inches As Double = 4.5
    Dim points = application.InchesToPoints(inches)
    Console.WriteLine($"{inches} inches is equal to {points} points.")
End Using

A complete working example in C# is present on this GitHub page.