I am currently working on a conversion from Excel to PDF. Due to the fact that the /convert API call doesnt work with page breaks. I need a bit of workaround of saving the file first in the container than saving it as PDF an then download it again. Which is a bit of a hussle since i already have the Excel in my S3 Storage and i also later need it there to read it.
With a configuration for that i would have 2 API Calls less than currently needed, or is it possible to enable page breaks in the /convert similiar to the /saveAs
Thanks in advance
@dzauner ,
Then I suggest you try the second method I used in my last post to convert a sheet to a PDF file, and I’ll share that code again:
CellsApi cellsApi = new CellsApi(Environment.GetEnvironmentVariable("CellsCloudClientId"), Environment.GetEnvironmentVariable("CellsCloudClientSecret"));
string filePath = @"D:\cells.cloud.family\cells.cloud\src\testdata\Cells\BookChart.xlsx";
UploadFileRequest uploadFileRequest = new UploadFileRequest();
uploadFileRequest.UploadFiles = new Dictionary<string, Stream>();
uploadFileRequest.UploadFiles.Add("BookChart.xlsx", File.OpenRead(filePath));
uploadFileRequest.path = "TestData\\BookChart.xlsx";
cellsApi.UploadFile(uploadFileRequest);
GetWorksheetWithFormatRequest worksheetWithFormatRequest = new GetWorksheetWithFormatRequest();
worksheetWithFormatRequest.folder = "TestData";
worksheetWithFormatRequest.name = "BookChart.xlsx";
worksheetWithFormatRequest.sheetName = "Sheet1";
worksheetWithFormatRequest.format = "PDF";
using (Stream stream = cellsApi.GetWorksheetWithFormat(worksheetWithFormatRequest))
{
using (Stream downloadFile = File.OpenWrite("GetOneSheetWithPDF.pdf"))
{
stream.CopyTo(downloadFile);
stream. Close();
downloadFile.Close();
}
}
Are there the page breaks already applied? Since in the /convert calls the page breaks are not being used and I get a single long page.
@dzauner ,
Currently, convert does not support page export, but the GetWorksheetWithFormat API supports page-specific format output, please refer to the code below:
CellsApi cellsApi = new CellsApi(Environment.GetEnvironmentVariable("CellsCloudClientId"), Environment.GetEnvironmentVariable("CellsCloudClientSecret"));
string filePath = @"BookChart.xlsx";
UploadFileRequest uploadFileRequest = new UploadFileRequest();
uploadFileRequest.UploadFiles = new Dictionary<string, Stream>();
uploadFileRequest.UploadFiles.Add("BookChart.xlsx", File.OpenRead(filePath));
uploadFileRequest.path = "TestData\\BookChart.xlsx";
cellsApi.UploadFile(uploadFileRequest);
GetWorksheetWithFormatRequest worksheetWithFormatRequest = new GetWorksheetWithFormatRequest();
worksheetWithFormatRequest.folder = "TestData";
worksheetWithFormatRequest.name = "BookChart.xlsx";
worksheetWithFormatRequest.sheetName = "Sheet1";
worksheetWithFormatRequest.pageIndex = 0;
worksheetWithFormatRequest.format = "PDF";
using (Stream stream = cellsApi.GetWorksheetWithFormat(worksheetWithFormatRequest))
{
using (Stream downloadFile = File.OpenWrite("GetOnePageWithPDF.pdf"))
{
stream.CopyTo(downloadFile);
stream. Close();
downloadFile.Close();
}
}
@dzauner ,
You use S3 to store your files, you can bind your storage space through your AsposeCloud dashboard.
In this way, when you call the Cells Cloud API, you only need to specify the name of the storage space, and you can access the data directly, without uploading the file again.
CellsApi cellsApi = new CellsApi(Environment.GetEnvironmentVariable("CellsCloudClientId"), Environment.GetEnvironmentVariable("CellsCloudClientSecret"));
string filePath = @"BookChart.xlsx";
GetWorksheetWithFormatRequest worksheetWithFormatRequest = new GetWorksheetWithFormatRequest();
worksheetWithFormatRequest.folder = "TestData";
worksheetWithFormatRequest.name = "BookChart.xlsx";
worksheetWithFormatRequest.sheetName = "Sheet1";
worksheetWithFormatRequest.pageIndex = 0;
worksheetWithFormatRequest.format = "PDF";
worksheetWithFormatRequest.storageName = "NewS3Storage";
using (Stream stream = cellsApi.GetWorksheetWithFormat(worksheetWithFormatRequest))
{
using (Stream downloadFile = File.OpenWrite("GetOnePageWithPDF.pdf"))
{
stream.CopyTo(downloadFile);
stream. Close();
downloadFile.Close();
}
}
I am using a self hosted container i dont want the s3 storage do be in de aspose dashboard since it is only accessible with in my cloud and not from the aspose dashboard. A configuration in container startup would be great to add a external storage
@dzauner ,
Then I see, we’ll try to add the convert query parameter to implement your needs.
By the way, If the existing API does not support it and we are able to implement such a function, we can customize the new API according to your needs.
@dzauner
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSCLOUD-12932
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.