Free Support Forum -

Converting excel to PDF with Aspose.Cells Cloud SDK for .NET C#- breaking sheet rows


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

Thanks in advance


Thank you for contacting Aspose Support.

Please use POST /cells/{name}/SaveAs API to convert an Excel Document to PDF. To ensure all columns of the sheet appear on the same page, please set OnePagePerSheet parameter value to true. The cURL example of the API looks as follows:

// First get Access Token
// Get App Key and App SID from
curl -v "" \
-d 'grant_type=client_credentials&client_id=0B17F60A-6D69-426B-9ABD-79F35A6E9F7B&client_secret=53b8b19adffa41a3e87dbbd8858977ae' \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

// cURL example to convert Excel Document to PDF
curl -v "" \
-d '{"SaveFormat": "pdf", "OnePagePerSheet": true}' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer dr0rqpV6GyvwA0hu-I0QdFFjTpOa6EsWEGyN17vMndwFHbXFW0WETHA82ygW1oMswxwmCgJlHb655KpTykA5qyf9yvccZ2l2MZZpy0XNW9a4XrY6C3a-LjnJn8_PzTO69WPttLT-O2rOa0vqTlK6cYTcr9Ktk-mzqUQaiOdPfS_q5Nhcq93KfQbHJ3TAfdXY5VlGUxaoyiIpdYSHWcK4vyrm8iYMevcN_kIJivted8etNHl31RjvSuGGDmamVxAunymP4ubpasUX-2jzVStStyZoo4d1AQiaRSAJX_EqmswXv8lXsFK51PsGJIJoZs-VBVv2j5FUhTy5zm-CNjcLD4WTf8conR1zYjqNTPXKeBxDn6mpXMDG05kfCpdbEFDw9wdF0Y2DVglEn4r8P_1rIUtdhr4cN24E9uqeK63reCKnqzciGKep9SKmIlqFLucOHdEPUXZYE8lZHkxvHzaz0CphS6A" 

The complete list of PDF Save Options are:

	<-- PDF property -->
	<-- save option property -->

We recommend you use our Cloud SDKs to call our APIs. SDKs take care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project.

Thanks but this is not answer my question, what about the rows? when using OnePagePerSheet=true
All columns and all rows will be printed in one page for a sheet.


Please call POST /cells/{name}/worksheets/{sheetName}/pagesetup API with FitToPagesTall parameter value to 0 and FitToPagesWide parameter value to 1. The cURL example will look as follows:

curl -v "" \
-d '{"FitToPagesTall": 0, "FitToPagesWide": 1}' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ZD_EYKUeojMEkxefqvwNFri5g4V7RbVrAxIX4yhgveGipzY7wqIGdyQX7YMhMhPddICOsvnXPazQxXX7GGkkTjba5vAacsROzwu8ZfCRcDd-8IfYbdzhDIeB73Bc_gxtFzw3XHfXpGfoJtDfZ0Oe0r12QEE2sjistJI-1SxCGFlW83lRw_I_hZepvSqFYLJzFnbX8DhR3B1gT9BWe_n2CAwZ80KmE6VHYdmhPQLuuFrbzTOf3jl2yShV8QamUQInQmNTPSqdeSu4foAc_bZahlbGhncF4G-f-sCcHx1iexuR-9rH1gVO6OH4Fpp40r5qUbgrW8zX7sH6ewg31KYD05CkU36Dz4jyCC9HBPTQWtuT5HGMUkuLtTlsl_fut6IWwQDf30220VPQO18wM6rseiqTd2YKgb2frYH_TfXwupHMmHbwBh-HcR9TVOuKqAk4xEupkSq7iLzwcy5vEfu0KmwQ8GE" 

Then call POST /cells/{name}/SaveAs API with OnePagePerSheet parameter value to false and SaveFormat parameter value to pdf. The cURL example of this API is already shared above.

These two APIs will let you show all columns in one page and distribute/break rows over several pages.

I hope this helps!

I believe this API is not supported by Com.Aspose.Cells.Api , what is the recommended way to call it?
Do you have some other API?
Can you provide a solution in C#? also how do I get the names of all worksheets?


This forum is for topics related to Aspose REST APIs. Am I right in my understanding that you are interested in Aspose Native/Downloadable APIs? If yes, I will move your query to and one of my colleagues will glad to help you.

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


The shared code is of Native APIs. Please follow this thread for an answer to your query.

I am using the cloud API , I can work with the .NET api (which I assume juts send REST call ) or directly with the REST API , Just need to see a sample how to call the REST API with HttpClient or other, what is the recommended way?



Please install Aspose.Cells Cloud NuGet package from here Instructions to use the SDK are given here.

Once installed please call CellsPageSetupPostPageSetup API with parameter values shared above. Unit Test of the API is given here.

Then call CellsSaveAsPostDocumentSaveAs API with OnePagePerSheet parameter value to false and SaveFormat parameter value to pdf. Unit Test of the API is given here.

I hope the above is useful to you.

1 Like

What is the difference between


and the one I am currently using:


Link to tests is broken,

please explain the difference between the APIs

Also I need to do it for all sheets, how do I get the sheet names?


Please don’t confuse between Aspose REST and Native APIs.

Com.Aspose.Cells.Api; is a native library where all the processing will be done on your local system. As you said earlier you are using Aspose REST APIs so please forget about Com.Aspose.Cells.Api; and simply delete this library.

Aspose.Cells.Cloud.SDK.Api is the Cloud SDK code. Cloud SDKs give you convenience to call REST APIs. SDKs handle low-level details of APIs authentication, making requests and handling responses and lets you focus on writing code specific to your project.

1 Like

Link to tests is broken,

Please use this URL for Unit Tests:

1 Like

Also I need to do it for all sheets, how do I get the sheet names?

Please use GET /cells/{name}/worksheets API to get Worksheet names.

CellsWorksheetsGetWorkSheets Unit Test example is given here.

1 Like

I understand that , but previously we used this API, see it also point to Aspose.Cells-Cloud.dll

image.png (32.3 KB)

but the namespace is Com.Aspose.Cells.Api instead of Aspose.Cells.Cloud.SDK.Api

Where do I get this information from?

static string grantType = “client_credentials”;
static string clientId = “your clientId”;
static string clientSecret = “your clientSecret”;

(it is part of the tests source code)



Please check this article it explains how to get App Key (clientSecret) and App SID (clientId).

If you want further details, please check Authenticating API Requests article it explains how API requests are authenticated.

1 Like

Mohammed, I thank you for your patience and support, finally the API is working.
Now I will test if I can get expected result