Free Support Forum -

Difference between xlsx and pdf when using conditional formatting


I have added some conditional formatting to a spreadsheet and it is working perfectly. (I am setting the background color of cells based on the value of the cell.) However, when I save it as pdf, the colors are not right.

Example of the problem: when a value = 0, the cell background should be white, but in the pdf it is light green. Please look at the tab named "% Variance from Forecast".

Note that I added some test data on the xlsx to show the full range of colors that the condition are set to show. These rows are not in the PDF.

I have attached a sample of each format.

I am using version




Thanks for the sample files.

Please try using our latest version/fix: Aspose.Cells for .NET v7.3.4.2

I have tested to convert your sample Excel file to PDF and it works fine with it. The conditional formatting
is rendered fine in the output PDF.

Thank you.

Thanks very much. It does work now.

Just so you know, when I first ran my code with the Aspose.Cells version, my xlsx files were being saved as 0 bytes. I figured out that when saving to a stream, it leaves the position of the stream at the end. In previous versions, it set the position to 0. When saving to PDF, it positions it to 0.

I changed my code to set the position to 0, and it works, but I thought I would let you know the different save methods are not consistent.



Good to know that your issue is resolved by the new fix v7.3.4.2.

And, yes, when you save to memory stream, you need to set it to position “0”.

If you need further help or have any other issue, let us know, we will be happy to assist you.

Thank you.