Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The FitToPagesWide and FitToPagesTall settings are used in spreadsheet applications (like Microsoft Excel) to control how a spreadsheet is scaled when printing. These settings help ensure that your printed output fits within a specified number of pages, both horizontally and vertically. Here’s a breakdown of each setting:
Here are some reasons to set FitToPagesWide and FitToPagesTall:
To set the FitToPagesWide and FitToPagesTall settings in Microsoft Excel, follow these steps:
To set FitToPagesWide and FitToPagesTall in a specified worksheet: first, load the sample file, and then modify the Worksheet.GetFitToPagesTall() and Worksheet.GetFitToPagesWide() properties of the PageSetup object for the desired worksheet. Here is an example in C++:
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Instantiate a Workbook object
Workbook workbook(U16String(u"input.xlsx"));
// Access the first worksheet in the Excel file
Worksheet worksheet = workbook.GetWorksheets().Get(0);
// Set the number of pages to which the length of the worksheet will be spanned
worksheet.GetPageSetup().SetFitToPagesTall(1);
// Set the number of pages to which the width of the worksheet will be spanned
worksheet.GetPageSetup().SetFitToPagesWide(1);
// Save the workbook
workbook.Save(U16String(u"out_net.pdf"));
std::cout << "Workbook saved successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
The output result:
To print a worksheet as one page: first, load the sample file, and then set the PdfSaveOptions.GetOnePagePerSheet() property of the PdfSaveOptions object. Here is an example in C++:
#include <iostream>
#include "Aspose.Cells.h"
#include "Aspose.Cells/PdfSaveOptions.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Instantiate a Workbook object
Workbook workbook(u"sample.xlsx");
// Create PdfSaveOptions object
PdfSaveOptions options;
// Set options for exporting PDF
options.SetOnePagePerSheet(true);
// Save the workbook to a PDF file
workbook.Save(u"OnePagePerSheet.pdf", options);
std::cout << "Workbook saved as OnePagePerSheet.pdf!" << std::endl;
Aspose::Cells::Cleanup();
}
The output result:
To print all columns of a worksheet on one page: first, load the sample file, and then set the PdfSaveOptions.GetAllColumnsInOnePagePerSheet() property of the PdfSaveOptions object. Here is an example in C++:
#include <iostream>
#include "Aspose.Cells.h"
#include "Aspose.Cells/PdfSaveOptions.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Instantiate a Workbook object with the specified file.
Workbook workbook(u"sample.xlsx");
// Create PdfSaveOptions instance.
PdfSaveOptions options;
// Set options for saving the workbook as a PDF.
options.SetAllColumnsInOnePagePerSheet(true);
// Save the workbook as a PDF file with the specified options.
workbook.Save(u"AllColumnsInOnePagePerSheet.pdf", options);
std::cout << "Workbook saved successfully as PDF!" << std::endl;
Aspose::Cells::Cleanup();
}
The output result:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.