Hi I have an excel file,When I convert my file to pdf,aspose gives only a blank pdf.I attached a sample file for u
My codes like this,
Workbook workbook = new Workbook();
workbook.Open("C:\\test.xls");
Aspose.Cells.
PdfSaveOptions opts = new Aspose.Cells.PdfSaveOptions();
opts.OnePagePerSheet = true;
workbook.Save("C:\\test.pdf",opts);
What can I do to fix this problem?
Hi,
Please follow the code below for converting to PDF:
Workbook workbook = new Workbook();
workbook.Open(“E:\test.xls”);
workbook.Save(“E:\test.pdf”, SaveFormat.Pdf);
Thanks
Hi,
I have to use the following code becase If I don't, all pages are mixing.If I don't use OnePagePerSheet ,I can open pdf I know this but I have to use.
PdfSaveOptions opts = new Aspose.Cells.PdfSaveOptions();
opts.OnePagePerSheet = true;
Hi,
It seems, you are using older version.
Please download and use the latest version:
Aspose.Cells
for .NET v7.2.0.2
and let us know your feedback.
If the problem still occurs with latest version, then we will need your source (xls/xlsx) file i.e test.xls to look into this issue.
Hi I'm currently using 7.1.2.1 version when I change my aspose dll to 7.2.0.2 my codes were broken,
myWorkbook.SaveOptions.SaveFormat = Aspose.Cells.SaveFormat.Auto;
//and the other one;
if (extension.ToLower() == ".xls"||extension.ToLower() == ".xlm")
{
myWorkbook.SaveOptions.SaveFormat = Aspose.Cells.
SaveFormat.Excel97To2003;
myWorkbook.Save(
this.Response, Server.UrlEncode(tempFileName + extension), Aspose.Cells.ContentDisposition.Attachment, myWorkbook.SaveOptions);
}
Hi,
Well, in the new versions, you need to update your existing codes a bit regarding SaveOptions. We felt it might not be worth while to provide separate SaveFormat attribute when we already allow to set the SaveFormat in the constructors of the APIs. See the following lines for your reference. You should use SaveOptions APIs' constructors to specify the SaveFormat accordingly now.
e.g. See the examples below:
//Html
var htmOptions = new HtmlSaveOptions(SaveFormat.Html);
//XLSX
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx);
//XLSM
var saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsm);
//PDF
PdfSaveOptions saveOption = new PdfSaveOptions(SaveFormat.Pdf);
//ODS
OdsSaveOptions saveOptions = new OdsSaveOptions(SaveFormat.ODS);
//XLS Response.
workbook.Save(HttpContext.Current.Response, "test.xls",
Aspose.Cells.ContentDisposition.Attachment, new XlsSaveOptions(Aspose.Cells.SaveFormat.Excel97To2003));
HttpContext.Current.Response.End();
etc.
Hope, this helps you.
Thank you.
Hi,
I was able to reproduce your stated issue with the help of your attached file and following lines of code:
Workbook workbook = new Workbook(“C://test2.xls”);
PdfSaveOptions saveOption = new PdfSaveOptions(SaveFormat.Pdf);
saveOption.OnePagePerSheet = true;
Worksheet sheet = workbook.Worksheets[0];
workbook.Save(“c://test.pdf”, saveOption);
We have logged this issue into our database for further action by the development team.
This issue has been logged as CELLSNET-40625.
Thanks
Hi,
It is not a bug related to Aspose.Cells for .NET and it’s a bug of Adobe Reader.
We think it is related to Adobe Reader setting.
Please deselect two options in Adobe setting , Edit->preference->View-> ( something like 2d accelerate |graphic smooth ) .
When we use other PDF viewer, we could read the content without issue.