Skip to main content

UnitConverter.PointsToTwips(Single) Method

Converts a value points to twips.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v23.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public static int PointsToTwips(
    float value
)

Parameters

Name Type Description
value Single

The value in points.

Returns

Type Description
Int32

The value in twips.

Remarks

The example below changes the height and width of the section‘s pages.

<DxRichEdit @ref="richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            var sections = await documentAPI.Sections.GetAllAsync();
            foreach (Section s in sections)
                await s.ChangePropertiesAsync(properties => {
                    if (s.PageSize.Width != UnitConverter.PointsToTwips(595))
                        properties.PageSize.Width = UnitConverter.PointsToTwips(595);
                    if (s.PageSize.Height != UnitConverter.PointsToTwips(842))
                        properties.PageSize.Height = UnitConverter.PointsToTwips(842);
                });
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also