Cells create custom papersize

It is possible to define a custom/user paper size?
This message was posted using Banckle Live Chat 2 Forum


Thanks for your posting and using Aspose.Cells.

Aspose.Cells supports all the Paper Sizes as supported by MS-Excel. However, you cannot use any custom paper size.

You can select your paper size using the PaperSizeType enumeration which enlists all the paper sizes of the MS-Excel. I have attached the screenshot for your reference.

Also, if your custom paper size is not supported, you can let us know its name and dimensions, then we may add its support in our future versions.

Please see the following sample code sets the paper size of the worksheet.


Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

worksheet.PageSetup.PaperSize = PaperSizeType.PaperA4Rotated;


Thanks for considering Aspose APIs.

Please use the Worksheet.PageSetup.CustomPaperSize() method with the most recent version i.e. Aspose.Cells for .NET (Latest Version) for your needs. Please see the following code, its output Pdf and screenshot for a reference.

output-5x6-inches.zip (9.7 KB)


//Create workbook
Workbook wb = new Workbook();

//Access first worksheet
Worksheet ws = wb.Worksheets[0];

//Write some data in cell B4
ws.Cells["B4"].PutValue("This is sample data.");

//Set custom paper size, it is 5 x 6 inches
ws.PageSetup.CustomPaperSize(5, 6);

//Save it as pdf