Created
January 22, 2025 19:50
-
-
Save conholdate-gists/12689890c54a20b4b0bcdac048cd4645 to your computer and use it in GitHub Desktop.
Convert Publisher File to Excel XLS XLSX in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize a MemoryStream to hold output document | |
MemoryStream stream = new MemoryStream(); | |
// Load input PUB file | |
Aspose.Pub.IPubParser parser = Aspose.Pub.PubFactory.CreateParser("input.pub"); | |
// Parse the input publisher file | |
Aspose.Pub.Document doc = parser.Parse(); | |
// Convert the PUB file to PDF and save result in a MemoryStream | |
Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(doc, stream); | |
// Load input PDF file from the MemoryStream | |
Aspose.Pdf.Document document = new Aspose.Pdf.Document(stream); | |
// Initialize ExcelSaveOptions class object | |
Aspose.Pdf.ExcelSaveOptions options = new ExcelSaveOptions(); | |
// Specify the format of output Excel file | |
options.Format = ExcelSaveOptions.ExcelFormat.XLSX; | |
// Save output Excel file | |
document.Save("PUBToExcel.xlsx", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment