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

Free Support Forum - aspose.com

Converting excel to PDF- breaking sheet rows

Hi,

I have an excel file with several sheets.
Each sheet contain 20 columns and 1000 rows
I would like to convert the excel to pdf such that columns will always displayed in one page (either in fit mode or not) while rows will be break to several pages

For example assuming I have 2 sheets with 20 columns and 1000 rows each , and assuming a page can contains 100 rows

I would like to get a pdf with 20 pages in each page , on each page 20 columns and 100 rows

OnePagePerSheet option will not work because all columns and all rows will be printed in one page for a sheet.

this is the API I am currently using

Com.Aspose.Cells.Model.SaveResponse cellsApiResponse = cellsApi.PostDocumentSaveAs(originalFileName, pdfFileName, isAutoFitRows, isAutoFitColumns, storage, folder, cellsBody);
apiResponseStatus = cellsApiResponse.Status;

But in this API I don’t see a pagesetup function


This Topic is created by sohail.aspose using the Email to Topic plugin.

@kikkoman,

You can fit all columns in a single page with AllColumnsInOnePagePerSheet property while converting your Excel workbook to PDF. See the document with example code for your reference:
https://docs.aspose.com/display/cellsnet/Fit+All+Worksheet+Columns+on+Single+PDF+Page

Please let us know your feedback, and share a sample file with us if this does not fulfill your requirements.

I am using the Cloud API

//TODO: check those 2 parameters
bool isAutoFitRows = false;
bool isAutoFitColumns = false;
SaveOptions cellsBody = new SaveOptions
{
CalculateFormula = true,
CheckFontCompatibility = false,
Compliance = “None”,
OnePagePerSheet = false,
SaveFormat = “pdf”
};
CellsApi cellsApi = new CellsApi(APP_KEY, APP_SID, BASEPATH);

                //Get the worksheet names?
                WorksheetsResponse worksheetResponse = cellsApi.GetWorkSheets(originalFileName, storage, folder);
                Com.Aspose.Cells.Model.SaveResponse cellsApiResponse = cellsApi.PostDocumentSaveAs(originalFileName, pdfFileName, isAutoFitRows, isAutoFitColumns, storage, folder, cellsBody);
                apiResponseStatus = cellsApiResponse.Status;

@kikkoman,

Please note, if you are using Aspose.Cells for Clould APIs, please post and follow up your thread in Aspose.Cells for Cloud forum:

And, if you are using Aspose.Cells Native/Downloadable APIs, check below:
As suggested in previous post, please try to use AllColumnsInOnePagePerSheet option to accomplish the task. If you still find any issue, kindly do provide us your template Excel file. Also provide your desired Excel file, you may create your desired Excel file in MS Excel manually (using PageSetup and other options). When opening the your desired file into MS Excel manually and taking the print preview of the sheets, it should show 20 columns with 10 pages in total. For your information, Aspose.Cells does render MS Excel file to PDF file format as it is shown in print preview (of MS Excel) for different sheets. So, in print preview for different sheets, you should see your desired results.

I am using Aspose.Cells for Cloud APIs , please delete unrelated posts.

@kikkoman,

Thanks for the confirmation.

You may post and follow up your issue in Aspose.Cells for Cloud forums.

And, no need to remove the posts/thread here as there is no confidential data or files shared in the thread.