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

Free Support Forum - aspose.com

Save to Excel formatting

We want to use Aspose.PDF to create reports with a table. The table rows, cells will have simple formatting for border, background etc. This works when saved to PDF, but when saved to Excel format all row/cell formatting is lost.

Is this by design? How can we retain that formatting when saving to Excel format.



Thanks for contacting support.

Would you please share your sample PDF document with us which you are trying to convert into Excel format. We will test the scenario in our environment and address it accordingly.

We are not converting documents to Excel. We are generating documents that will be saved as both PDF and Excel. Below is the very simple test code:

        var doc = new Aspose.Pdf.Document();
        Page page = doc.Pages.Add();

        // Initializes a new instance of the Table
        var table = new Table
            Border = new BorderInfo(BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(Color.DeepPink)),

            DefaultCellBorder = new BorderInfo(BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(Color.LightGray))

        // Set the table border color as LightGray
        // Set the border for table cells
        // Create a loop to add 10 rows
        for (var rowCount = 1; rowCount < 10; rowCount++)
            // Add row to table
            var row = table.Rows.Add();

            row.BackgroundColor = Aspose.Pdf.Color.FromRgb(Color.CornflowerBlue);

            // Add table cells
            row.Cells.Add("Column (" + rowCount + ", 1)");
            row.Cells.Add("Column (" + rowCount + ", 2)");
            row.Cells.Add("Column (" + rowCount + ", 3)");


        doc.Save(@"e:\dev\report\outfile.pdf", SaveFormat.Pdf);

        var exs = new Aspose.Pdf.ExcelSaveOptions();
        exs.Format = ExcelSaveOptions.ExcelFormat.XLSX;
        doc.Save(@"e:\dev\report\outsp.xls", exs);

The generated PDF shows the border and background colors. This formatting is lost when saved to ExcelFormat.


Thanks for sharing sample code snippet.

We were able to notice that API was unable to honor formatting and styles in output Excel file. The issue is related to PDF to Excel Rendering Engine and has been logged as PDFNET-46103 in our issue tracking system for the sake of correction. We will further look into details of the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.