We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ODS to PDF conversion - process runs for ever in .NET

With 21.9.0

var workbook = new Workbook(@“C:\Concierge\file.ods”);
workbook.Save(@“C:\Concierge\file.pdf”);

problematicfile.zip (85.9 KB)

@nielsbosma,
If you open this ODS file in MS Excel and take the print preview, you can see that it contains 3,810,832 pages. Similarly if you try to convert this ODS file to PDF using MS Excel, it also fails. You need to update the print area of your ODS file and then convert it to PDF which takes around 4 to 5 seconds for the conversion. Please give a try to the following updated ODS file and share your feedback.
AAROGYA RSS LIST_Updated_PrintArea.ods.zip (87.2 KB)

Is there any way to set the print area using Aspose? The whole point with using Aspose is because the user don’t have access to Excel. I need automate the whole process.

@nielsbosma,
You can set the print area with below code:

Workbook wb = new Workbook("test.ods");
wb.Worksheets["sheet1"].PageSetup.PrintArea = "A1:C22";
wb.Save("output.pdf");

Let us know your feedback.

@nielsbosma,

Moreover, if you do not have access to template Excel file and do not know actual data range of the sheet, you may use Worksheet.Cells.DeleteBlankRows and Worksheet.Cells.DeleteBlankColumns (on safer side) to remove all unnecessary blank rows and columns before rendering to PDF. See the sample code for your reference. I have tested it using your input ODS file and it works fine and efficiently:
e.g.
Sample code:

Workbook wb = new Workbook("e:\\test2\\AAROGYA RSS LIST.ods");
wb.Worksheets[0].Cells.DeleteBlankRows();
wb.Worksheets[0].Cells.DeleteBlankColumns();
wb.Save("e:\\test2\\output.pdf");

Hope, this helps a bit.