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

Free Support Forum - aspose.com

Missing data in some cells when converting to pdf

When converting the attached excel file to a pdf (using version 18.12.0.0) there are some cells missing in the generated document (the cell content is there in MS-Excel Print Preview). The problem seems to occur only when saving a workbook to a memory stream as xlsx and then creating a new workbook from that stream and saving it to a pdf format. Below is an example of a working and a non-working method illustrating the problem. The generated pdf document contains all the data with the first method, but some cells are missing when using the second one.

public static void Working()
{
    // Create from file
    var workbook = new Workbook("Test.xlsx");

    // Save the workbook as pdf
    var pdfStream = new MemoryStream();
    workbook.Save(pdfStream, SaveFormat.Pdf);

    // Save to file
    File.WriteAllBytes("Test.pdf", pdfStream.ToArray());
}

public static void Broken()
{
    // Create from file
    var workbook = new Workbook("Test.xlsx");

    // Save to memory stream
    var xlsxStream = new MemoryStream();
    workbook.Save(xlsxStream, SaveFormat.Xlsx);

    // Create from memory stream
    var streamWorkbook = new Workbook(xlsxStream);

    // Save the workbook as pdf
    var pdfStream = new MemoryStream();
    streamWorkbook.Save(pdfStream, SaveFormat.Pdf);

    // Save the file
    File.WriteAllBytes("Test.pdf", pdfStream.ToArray());
}

One more thing… Please try to run the following code snippet without editing the excel file first. You can open it, but if you only double click on the cells that cause the problems (without editing their content), Microsoft Excel will ask to save the file when you try to close it. If you save the file, the problem seems to go away and then both methods work just fine.

Test.zip (6.8 KB)

@bushprakash1,

Thanks for the sample code with template file.

After an initial test, I observed the issue as you mentioned by using your sample code with your template file. I found some missing data/values in some cells when converting workbook back to PDF file format in two steps. I have logged a ticket with an id “CELLSNET-46525” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@bushprakash1,

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-46525”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@bushprakash1,

Please try our latest version/fix: Aspose.Cells for .NET v18.12.7 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells18.12.7 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.12.7 For .Net4.0.Zip (4.7 MB)