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

Free Support Forum - aspose.com

Having problem with PageSetup.FixToPages


I’m using version and having the problem of setting the page scaling.

my code as below:
sheet.PageSetup.FitToPagesTall = 1;
sheet.PageSetup.FitToPagesWide = 1;

The exported file will always take the default option (adjust to 100% normal size) and does not take effect of the scaling setting above.

Sorry, it’s a bug.

I have fixed it. You can get the next hotfix within a week. Now thanks for your patience.

Appears the problem listed above is fixed, however it is not clear on how to set the height to no value. This is a very common practice to set the page width to 1 and let the height be blank, which means it will automatically be calculated by Excel at print time. Manually I would go in and simply delete the Tall property. Does this capability exist? In theory I could specify a large number tall that should have no impact for smaller reports but have not tested that.

Thanks for your suggestion.

I will investigate to support this in object modal within one week. Now you can set it in your designer file and using Aspose.Excel to import it.

Now you can try this line of code:

sheet.PageSetup.FitToPagesTall = 0;

I want adjust 77% normal size to my excel sheet from the visual basic.
How can I do that? send me sample coding immediately

Best Regards


You can try this:

Dim Excel as Aspose.Excel = new Excel()
Excel.Worksheets(0).PageSetup.Zoom = 77

Aspose.Excel is discarded and no more continued now. It is replaced with an advanced version Aspose.Cells which contains all the features of Aspose.Excel as well as supports all the latest versions of MS Excel. This new product also contains features to configure the page setup and printing options. Following is a sample code which demonstrates these features in detail:

// Open the template workbook
Workbook workbook = new Workbook(dataDir + "CustomerReport.xlsx");

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Setting the orientation to Portrait
worksheet.PageSetup.Orientation = PageOrientationType.Portrait;

// Setting the scaling factor to 100
// worksheet.PageSetup.Zoom = 100;

// OR Alternately you can use Fit to Page Options as under

// Setting the number of pages to which the length of the worksheet will be spanned
worksheet.PageSetup.FitToPagesTall = 1;

// Setting the number of pages to which the width of the worksheet will be spanned
worksheet.PageSetup.FitToPagesWide = 1;

// Setting the paper size to A4
worksheet.PageSetup.PaperSize = PaperSizeType.PaperA4;

// Setting the print quality of the worksheet to 1200 dpi
worksheet.PageSetup.PrintQuality = 1200;

//Setting the first page number of the worksheet pages
worksheet.PageSetup.FirstPageNumber = 2;

// Save the workbook
workbook.Save(dataDir + "PageSetup_out.xlsx");

Here is a link to the document where you may find more details about page setup:
Page Setup and Printing Options

A free version for trials can be downloaded here:
Aspose.Cells for .NET (Latest Version)

For better unsder standing of this new product you may download a ready to run solution here.