Ignore Errors while Rendering Excel to PDF

Possible Usage Scenarios

Sometimes when you convert your Excel file to PDF, errors or exceptions occur and the conversion process terminates. You can ignore all such errors during the conversion process by using the PdfSaveOptions.ignore_error property. This way, the conversion process will complete smoothly without throwing any error or exception but the loss of data may occur. Therefore, please use this property only if the loss of data is not critical for you.

Ignore Errors while Rendering Excel to PDF

The following code loads the sample Excel file but the sample Excel file is erroneous and throws an error during conversion to PDF in 17.11 but since we are using PdfSaveOptions.ignore_error property, it does not throw an error. However, one rounded red arrow like shape as shown in this screenshot is lost.

todo:image_alt_text

Sample Code

from aspose.cells import PdfSaveOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Load the Sample Workbook that throws Error on Excel2Pdf conversion
wb = Workbook("sampleErrorExcel2Pdf.xlsx")
# Specify Pdf Save Options - Ignore Error
opts = PdfSaveOptions()
opts.ignore_error = True
# Save the Workbook in Pdf with Pdf Save Options
wb.save("outputErrorExcel2Pdf.pdf", opts)