internal static void ExportExcelFile(string filename) { try { var path = $"original\\{filename}"; Document doc = new Document(path); // Check for password protection var info = Aspose.Cells.FileFormatUtil.DetectFileFormat(path); if (info.IsEncrypted) { throw new Exception("The excel file is password protected..."); } Aspose.Cells.Workbook book = new Aspose.Cells.Workbook(path); if (book.HasRevisions) { book.AcceptAllRevisions(); } // add footer to each sheet var footerText = string.Empty; footerText = String.Format("Διανομή μέσω 'ΙΡΙΔΑ' με UID: {0} στις {1}", filename, DateTime.Now.ToString("dd/MM/yy HH:mm")); var sheets = book.Worksheets; foreach (var sheet in sheets) { var pSetup = sheet.PageSetup; pSetup.SetFooter(1, footerText); } //set file metadata var properties = book.BuiltInDocumentProperties; properties["Title"].Value = "Δοκιμή Εγγράφου"; properties["Author"].Value = "Aspose Test Excel"; var extIndex = filename.LastIndexOf("."); filename = filename.Remove(extIndex); filename = filename.Insert(extIndex, ".pdf"); var outputPath = $"revised\\{filename}"; book.Save(outputPath, Aspose.Cells.SaveFormat.Pdf); Console.WriteLine("Converted excel document"); } catch (Exception exc) { Console.WriteLine(exc.Message); } }