Hi all,
I have converted Excel to Pdf as following sample :
https://docs.aspose.cloud/display/cellscloud/Convert+Excel+Workbook+to+Different+File+Formats
In the pdf result, the paragraphs are spreading out but do not appear like that in excel template. I don’t understand why. Please show me how to fix it.
Thanks,
Chien
Hi Chien,
Thank you for contacting Aspose support.
We have evaluated your presented scenario by converting the provided spreadsheet with Aspose for Cloud service and Microsoft Excel application. We are not able to notice any problem with the Aspose’s generated PDF, moreover, the two PDF files (attached) look very similar. Due to this comparison, I think that the result produced by Aspose for Cloud service is correct. Please note, I have used the Aspose for Cloud Java SDK with following XML to evaluate this scenario. Please share the XML (preferably executable code segment) to look further into this matter.
XML
String xml = “” +
“true” +
“true” +
“Pdf” +
“”;
Hi Babar,
Thank you for your response. I’m using the PdfSaveOptions in Aspose for Cloud as following:
And I have the result pdf as above (the spacing between paragraphs are not same as in original excel file). Please tell me what wrong with it.
true
true
false
None
400
95
false
Here is the extraction of my code (using Java + Aspose Cloud) :
+ Step 1 : Upload Excel file :
byte[] inputExcel = …
…
String uploadURI = Product.getBaseProductUri() + “/storage/file/”
+ uploadFileName;
String signUploadURI = com.saaspose.common.Utils.Sign(uploadURI);
String resultUpload = uploadFile(inputExcel, signUploadURI);
…
+ Step 2 : Save excel file into PDF on Aspose’s Server
StringBuilder xmlPdfOptions = new StringBuilder();
xmlPdfOptions .append("\n “);
xmlPdfOptions .append(”\n true");
xmlPdfOptions .append("\n true");
xmlPdfOptions .append("\n false");
xmlPdfOptions .append("\n None");
…
String strURIPdf = Product.getBaseProductUri() + “/cells/”
+ uploadFileName + “/saveAs?newfilename=” + pdfFileName;
String signedURISavePdf = com.saaspose.common.Utils.Sign(strURIPdf);
InputStream responseSave = com.saaspose.common.Utils.ProcessCommand(signedURISavePdf, “POST”, xmlPdfOptions .toString(),
“xml”);
…
+ Step 3 : Download result convert pdf
Thanks,
Chien
Hi Chien,
Hi again,
We have evaluated the presented scenario again on two different machines with following piece of code, and were not able to replicate the problem so far. Could you please try the case with this code snippet on your side? Please note, the code is using some methods from the Aspose Cloud for Java SDK so you may give it a try in a new project and share the resultant PDF. We hope to isolate the difference in statements/configurations with this test therefore we request you to download the sample spreadsheet from this thread, upload it to the cloud storage manually (using Aspose for Cloud GUI) and execute the conversion.
Java
String infilename = “Calc-text.xlsx”;
String outfilename = “calc-text(JavaSDK).pdf”;
StringBuilder xmlPdfOptions = new StringBuilder();
xmlPdfOptions .append("\n “);
xmlPdfOptions .append(”\n true");
xmlPdfOptions .append("\n true");
xmlPdfOptions .append("\n false");
xmlPdfOptions .append("\n None");
xmlPdfOptions .append("\n 400");
xmlPdfOptions .append("\n 95");
xmlPdfOptions .append("\n false");
xmlPdfOptions .append("\n Pdf");
xmlPdfOptions .append("\n ");
String strURI = “http:[//api.aspose.com/v1.1/cells/"+infilename+"/saveAs?newfilename=](https://api.aspose.com/v1.1/cells/%22+infilename+%22/saveAs?newfilename=)” + outfilename;
String signedURI = Utils.sign(strURI);
Utils.processCommand(signedURI, “POST”, xmlPdfOptions.toString(), “xml”);
strURI = “http:[//api.aspose.com/v1.1/storage/file/](https://api.aspose.com/v1.1/storage/file/)” + outfilename;
signedURI = Utils.sign(strURI);
InputStream responseStream = Utils.processCommand(signedURI, “GET”);
Folder.saveStreamToFile(“D:/” + outfilename, responseStream);
responseStream.close();
System.out.println(“Done”);
Hi Chien,
Hi Babar,
Thank you for your help. I have tested it again and I realized that the result pdf would be wrong when I use the parameter &isAutoFitRows=true in converting PDF file from excel template (in Step 2) as following :
+ Step 2 : Save excel file into PDF on Aspose’s Server
StringBuilder xmlPdfOptions = new StringBuilder();
xmlPdfOptions .append("\n “);
xmlPdfOptions .append(”\n true");
xmlPdfOptions .append("\n true");
xmlPdfOptions .append("\n false");
xmlPdfOptions .append("\n None");
…
String strURIPdf = Product.getBaseProductUri() + “/cells/”
+ uploadFileName + “/saveAs?newfilename=” + pdfFileName;
strURIPdf += “&isAutoFitRows=true”;
String signedURISavePdf = com.saaspose.common.Utils.Sign(strURIPdf);
InputStream responseSave =
com.saaspose.common.Utils.ProcessCommand(signedURISavePdf, “POST”,
xmlPdfOptions .toString(),
“xml”);
…
Thanks,
Chien
Hi Chien,
Hi again,
Hi Chien,
This is to inform you that we have fixed the problem logged earlier as SAASCELLS-119. Please give this scenario another try on your side and let us know of your feedback.
Java
StringBuilder xmlPdfOptions = new StringBuilder();
xmlPdfOptions .append("\n “);
xmlPdfOptions .append(”\n true");
xmlPdfOptions .append("\n true");
xmlPdfOptions .append("\n false");
xmlPdfOptions .append("\n None");
xmlPdfOptions .append("\n 400");
xmlPdfOptions .append("\n 95");
xmlPdfOptions .append("\n false");
xmlPdfOptions .append("\n Pdf");
xmlPdfOptions .append("\n ");
//Convert the spreadsheet on storage
String strURI = “http:[//api.aspose.com/v1.1/cells/"+infilename+"/saveAs?newfilename=](https://api.aspose.com/v1.1/cells/%22+infilename+%22/saveAs?newfilename=)” + outfilename + “&isAutoFitRows=true”;
String signedURI = Utils.sign(strURI);
Utils.processCommand(signedURI, “POST”, xmlPdfOptions.toString(), “xml”);
//Download the converted file
strURI = “http:[//api.aspose.com/v1.1/storage/file/](https://api.aspose.com/v1.1/storage/file/)” + outfilename;
signedURI = Utils.sign(strURI);
InputStream responseStream = Utils.processCommand(signedURI, “GET”);
Folder.saveStreamToFile(“D:/” + outfilename, responseStream);
responseStream.close();
Hi Babar,
Thank you very much. I have tested it again and it’s OK now.
Best Regards,
Chien
Hi,
The issues you have found earlier (filed as SAASCELLS-119) have been fixed in this update and deployed to live service.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.