We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

What should I do to increase the size on the page of printouts?

A user is complaining that the printing of a spreadsheet is too puny, and wants it enlarged on the page to be (more) legible. What do I need to change to increase the size of the printed area?

I have this code to set up the printing features:

private void ConfigureForPrinting(int finalRow)
string lastColumn = GetExcelTextColumnName(pivotTableSheet.Cells.Columns.Count);
string printArea = String.Format("A1:{0}{1}", lastColumn, finalRow);
pivotTableSheet.PageSetup.PrintArea = printArea;
pivotTableSheet.PageSetup.Orientation = PageOrientationType.Landscape;
pivotTableSheet.PageSetup.Zoom = 100;
pivotTableSheet.PageSetup.FitToPagesWide = 1;
pivotTableSheet.PageSetup.FitToPagesTall = 50;

// "...with 1/2" margins"
pivotTableSheet.PageSetup.LeftMargin = 0.5;
pivotTableSheet.PageSetup.RightMargin = 0.5;
pivotTableSheet.PageSetup.TopMargin = 0.5;
pivotTableSheet.PageSetup.BottomMargin = 0.5;
pivotTableSheet.PageSetup.HeaderMargin = 0.5;
pivotTableSheet.PageSetup.FooterMargin = 0.5;

// Repeat rows
string repeatableRowRange = "$6:$7";
pivotTableSheet.PageSetup.PrintTitleRows = repeatableRowRange;
string repeatableColRange = string.Format("$A:${0}", lastColumn);
pivotTableSheet.PageSetup.PrintTitleColumns = repeatableColRange;

I basically copied this from legacy (EPPlus) code, which didn't have this size problem.

Is it the Zoom property, that needs to be increased from 100%?

Or might it be the FitToPagesTall property, which is 50 in the legacy code (and carried over, as shown above), but is shown as 1 in an Aspose Cells code example? SHould it be 1 instead of 50 (or anything else)?


Well, you may try to use PageSetup attributes (e.g Zoom) to enlarge the contents of the worksheet page(s). Anyways, if would best if you could provide us your desired Excel file (you may manually save the file Ms Excel) with your desired page size or set other PageSetup attributes, we will check and may suggest you the relevant APIs in Aspose.Cells.

Thank you.

Here is what it looks like (attached); all I need to know is which property needs to be changed. It would seem that zoom set to 100 would fill the entire page, but obviously that’s not the case.

NOTE: Changing Zoom from 100 to 200 made no difference. If there is a small amount of data, it looks fine, but if there is a little of data, it keeps it in that same area (only half of the page being used).

Update: The best I can do, manually, is to adjust scaling to 54%, as shown in the second screen shot. How can I do that programmatically?

I’m grasping at straws here, and am trying this, too (from https://www.aspose.com/api/net/cells/aspose.cells.rendering/imageorprintoptions):

ImageOrPrintOptions iopo = new ImageOrPrintOptions();
iopo.AllColumnsInOnePagePerSheet = true;
iopo.OnePagePerSheet = true;


Thanks for your posting and using Aspose.Cells.

Please change your code from

pivotTableSheet.PageSetup.Zoom = 100;
pivotTableSheet.PageSetup.FitToPagesWide = 1;
pivotTableSheet.PageSetup.FitToPagesTall = 50;
pivotTableSheet.PageSetup.FitToPagesWide = 1;
pivotTableSheet.PageSetup.FitToPagesTall = 0;
If FitToPagesTall or FitToPagesWide is set after PageSetup.Zoom, the Zoom will not take effect.

Nope, that doesn’t work - takes up only half of the page width:


Thanks for your posting and using Aspose.Cells.

Please share with us your source excel file. We will look into it and help you out in resolving this issue. Thanks for your cooperation in this regard and have a good day.