0

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)?

UPDATE

I tested increasing the Zoom value from 100 to 200, but it made no difference - the data is limited to the left half of the page, so with a lot of data, it's very scrunchy.

UPDATE 2

When I tweak it manually, the best FitToPagesWide value is 5 (6 or greater does not make it better, but less makes it worse). However, the best thing I can do is set Scaling to 54%:

enter image description here

How can I do this programmatically?

4

1 回答 1

2

We have updated you in this Aspose.Cells Forum Post that should fix your issue.

Note: I am working as Developer Evangelist at Aspose

于 2016-12-07T08:09:25.380 回答