LoadOptions.SetPaperSize

LoadOptions.SetPaperSize method

Sets the default print paper size from default printer’s setting.

public void SetPaperSize(PaperSizeType type)
ParameterTypeDescription
typePaperSizeTypeThe default paper size.

Remarks

If there is no setting about paper size,MS Excel will use default printer’s setting.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class LoadOptionsMethodSetPaperSizeWithPaperSizeTypeDemo
    {
        public static void Run()
        {
            // Create load options and set paper size to A5
            LoadOptions options = new LoadOptions();
            options.SetPaperSize(PaperSizeType.PaperA5);

            // Load workbook with the specified options
            Workbook workbook = new Workbook("example.xlsx", options);
            
            // Verify the paper size is set correctly
            Console.WriteLine("Paper size of first worksheet: " + workbook.Worksheets[0].PageSetup.PaperSize);
        }
    }
}

See Also