Format Landscape

Laurence -

Is there a way I can format a page to come out Landscape instead of Portrait?

Also, Say I have 5 columns, I would like to autofit the columns so they can see the text in that column when the page first opens up. Right now, it sometimes doesn’t expand the columns to the full width.

Any help you can give me is always appreciated.

Steven

Hi Steven,

To format a page to Landscape, please try:

excel.Worksheet[0].PageSetup.Orientation = PageOrientationType.Landscape;

To autofit column A, please try:

excel.Worksheet[0].AutoFitColumn(0);

@Steven_Tidwell,
Aspose.Excel is no more available now and is discontinued. It is replaced by a latest product Aspose.Cells which is not only efficient and contains support for all the latest features in different versions of MS Excel but it also supports features of its predecessor. Page setup options are fully supported in Aspose.Cells. You can set page orientation and another print page related paramters using this new product. Following sample code demonstrates this feature:

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();

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

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

// Save the Workbook.
workbook.Save(dataDir + "PageOrientation_out.xls");

For more description of this feature, follow the link below:
Page Setup Features

Download free trial version of this new product here:
Aspose.Cells for .NET (Latest Version)

Here is the link to a runnable solution which can be compiled and executed to test variety of features of this product.