XlsIO to PDF with conditional formatting

Good Morning.

I want to convert an Excel with some cells with conditional formatting to show different colors to PDF, but the PDF always shows the same color in all cells.

File xlsx:



File PDF:

Sometimes the first time I run the conversion it does it right, but the others fail.

I use net core 3.1 and xlsio.net.core version 191.0.54.

Thanks.




35 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team October 27, 2021 10:09 AM UTC

Hi Juan, 

Greetings from Syncfusion. 

We have released fixes for Excel file with conditional formatting to PDF in our latest version. We request you to upgrade to our latest version 19.3.0.47 and check if the issue is resolved. If the issue still persists, kindly share us the input Excel document and code snippet, which will be helpful for us in investigating the query and provide prompt solution at the earliest. 

Regards, 
Keerthi. 



JU Juan October 27, 2021 02:41 PM UTC

Thanks for your quick response.

I have installed the latest version (19.3.0.47) but the colors appear worse than before as only the color is displayed in one cell.

I am attaching the Excel file (template.xlsx).


My code:

var ruta = Path.Combine(_env.ContentRootPath, @"Plantillas\");

var plantillaExcel = Path.Combine(ruta, "Plantilla.xlsx");

MemoryStream outputStream = new MemoryStream();


            using (ExcelEngine excelEngine = new ExcelEngine())

            {

                try

                {

                    XlsIORenderer renderer = new XlsIORenderer();

                    IApplication application = excelEngine.Excel;

                    application.DefaultVersion = ExcelVersion.Excel2010;


                    FileStream inputStream = new FileStream(plantillaExcel, FileMode.Open);

                    IWorkbook Ilibro = application.Workbooks.Open(inputStream);

                    IWorksheet worksheet = Ilibro.Worksheets[0];

                    //Initialize the PdfDocument Class

                    PdfDocument pdfDoc = new PdfDocument();

                    //Initialize the ExcelToPdfConverterSettings class

                    XlsIORendererSettings settings = new XlsIORendererSettings();

                    settings.IsConvertBlankPage = false;

                    settings.ExportQualityImage = true;

                    settings.RenderBySheet = true;

                    settings.LayoutOptions = LayoutOptions.NoScaling;

                    settings.AutoDetectComplexScript = true;

                    //Assign the output PdfDocument to the TemplateDocument property of ExcelToPdfConverterSettings

                    settings.TemplateDocument = pdfDoc;

                    settings.DisplayGridLines = GridLinesDisplayStyle.Invisible;

                    //Convert the Excel document to PDf

                    pdfDoc = renderer.ConvertToPDF(Ilibro, settings);

                    inputStream.Dispose();

                    pdfDoc.Save(outputStream);

                    pdfDoc.Close();

                }

                catch (Exception ex)

                {

                    throw new Exception(ex.Message);

                }

            }

            return outputStream;




Thanks.




Attachment: Plantilla_444b41d9.zip


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team October 28, 2021 07:59 AM UTC

Hi Juan, 

Thanks for sharing the Excel document. 

We are able to reproduce the reported issue at our end and validating it currently. We will share the validation details in 2 business days, on November 1st,2021. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 1, 2021 12:06 PM UTC

Hi Juan, 

We appreciate your patience. 

We have confirmed the issue as Color scale CF is applied improperly when applied color scale CF with a discontinuous range in Excel to PDF conversion and logged a defect report. We will include the fix in our upcoming weekly NuGet release, which will be available by tomorrow (November 2nd,2021).  

We will let you know once the package is available to download from NuGet.org. 

Regards, 
Keerthi. 



JU Juan November 2, 2021 10:08 AM UTC

Thanks.


I will wait to be notified when it is available.


Regards.





KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 2, 2021 01:57 PM UTC

Hi Juan, 

We regret for the delay. 

The weekly NuGet release is postponed to November 3rd 2021. We will let you know one the release is rolled out. 

We appreciate your patience. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 3, 2021 11:56 AM UTC

Hi Juan, 
 
We appreciate your patience. 
 
We have included the fix to resolve the issue Color scale CF is applied improperly when applied color scale CF with a discontinuous range in Excel to PDF conversion in our weekly NuGet release version 19.3.0.48. This package can be now downloaded from below link. 
 
Kindly try this new package and let us know if the issue is resolved. 
 
Regards, 
Keerthi. 



JU Juan November 3, 2021 12:23 PM UTC

Thanks for the quick reply.

I have updated the package but the problem is not resolved.

The first time the PDF file is generated, it works fine:



But the second time the colors are all the same:



Is it necessary to do some kind of initialization before generating the PDF?

I am looking forward to your response.

Regards.




MC Mohan Chandran Syncfusion Team November 4, 2021 10:57 AM UTC

Hi Juan, 

Sorry for the inconvenience. 

We will check this scenario in which the issue is reproducing while running the application more than once and update the details on 9th November 2021. 

Regards, 
Mohan. 



JU Juan November 10, 2021 08:13 AM UTC

Hello, good Morning.

Have you managed to correct the problem?

Regards.




KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 10, 2021 03:08 PM UTC

Hi Juan, 
 
We deeply regret for the inconvenience.  
 
On validating the issue, we found that the issue is actually related to Syncfusion Calculate team and forwarded the query to concerned team for validation. Hence, we will share the validation details on November 11th,2021.  
 
We appreciate your patience. 
 
Regards, 
Keerthi. 




KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 11, 2021 04:52 PM UTC

Hi Juan, 

We deeply regret for the inconvenience. 

Concerned team is still validating the issue and have promised to share the details by November 12th,2021. Hence we will share the validation details tomorrow. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 12, 2021 01:15 PM UTC

Hi Juan, 
 
We appreciate your patience. 
 
We have confirmed the issue as Formula type ConditionalFormatting isn't working properly and logged a defect report. We will provide the patch for this issue on November 19th,2021. 
 
You can track the status of defect report through following feedback link. 
 
Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 19, 2021 03:16 PM UTC

Hi Muart, 

We appreciate your patience. 

We have fixed the issue Formula type ConditionalFormatting isn't working properly and generated custom assembly in the version 19.3.0.48. This custom assembly can be downloaded from below link. 

Kindly try this and let us know if the issue is resolved. 

Regards, 
Keerthi. 



JU Juan November 19, 2021 04:19 PM UTC

Hello.

When I run the application in debug, the dll file changes to the old version.

How can I test the new dll?


NOTE: 

I have tried to change the dll file in production and it gives an error.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 22, 2021 06:12 AM UTC

Hi Juan, 

We request your to remove the assemblies from GAC using Syncfusion Assembly Manager which is available in the Syncfusion Dashboard and also, delete bin and obj folders of the project. Refer to the following link for removing assemblies from GAC.  


Regards, 
Keerthi. 



JU Juan November 22, 2021 08:43 AM UTC

Sorry but I don't understand. 

I don't have the Assembly Manager installed. In my project I have these references:



How can I test the dll file that was sent to me?

Can't you create another version to install (for example 19.3.0.49)?


Regards




JU Juan November 22, 2021 09:43 AM UTC

I have added the reference to the dll file that was sent to me:


but I get this error:



Regards.





KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 23, 2021 11:50 AM UTC

Hi Juan, 

We deeply regret for the inconvenience. 

We have generated a custom NuGet package of version 19.3.0.48 and request you to download it from below link. 

Kindly un-install or remove the existing Syncfusion.XlsIO.Net.Core package from you project and install this new package. This will in-turn install the required Compression package by itself. 

Please try and let us know if the issue is resolved. 

Regards, 
Keerthi. 



JU Juan November 24, 2021 10:02 AM UTC

Hello.

Can this topic tell me something? Can you update the xlsio version?

Regards.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 25, 2021 01:05 PM UTC

Hi Juan, 

For now, we request to un-install or remove the existing Syncfusion.XlsIO.Net.Core package from your project and install the new package, that we have provided in our previous update. Regarding the new version, we will include the fix in our next weekly NuGet release version, which will be available on November 30th,2021.  

That version will be different from 19.3.0.48. We will let you know once the new version is available to download from nuget.org. 

Regards, 
Keerthi. 





KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 30, 2021 01:31 PM UTC

Hi Juan, 
 
Sorry for the inconvenience. 
 
We regret to let you know that we were unable to include the fix in our weekly NuGet release today. We will include the fix in our next weekly NuGet release version, which will be available on December 7th,2021, without fail. 
 
We appreciate your patience. 
 
Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 7, 2021 07:18 AM UTC

Hi Juan, 
 
We appreciate your patience. 
 
We have included the fix in our latest weekly NuGet release v19.3.0.57 and this version is available for download under the following link.   

Regards, 
Keerthi. 



JU Juan December 7, 2021 10:50 AM UTC

Thanks.

It works better (it always outputs the same), but I see that there are some values ​​that appear black:


Can you check it out?

R




KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 8, 2021 11:10 AM UTC

Hi Juan, 

Thanks for the update. 

We will check again and share a sample with weekly NuGet tomorrow (December 9th,2021). 

Regards, 
Keerthi. 



PD Pandikumar Duraivel Syncfusion Team December 9, 2021 10:22 AM UTC

Hi Juan, 
  
We have checked in the version (19.3.0.57) of XlsIO weekly NuGet and the mentioned issue is not reproduced on our end. We have prepared a sample for your reference, and the same can be downloaded from the below link. 
  
Sample link: 
  
Kindly check this sample. If the issue persists, kindly share us the Excel document you are using at your end, which will be helpful for us to investigate the query and provide a prompt solution at the earliest. 
  
Regards, 
Pandi kumar D. 



JU Juan December 9, 2021 03:27 PM UTC

 

Thanks for the example.

I have already seen the problem where the data appears black.

If the value has many decimal places it does not look good, for example 0.9999333377774815


If I reduce the number of decimal places, it works fine!


Thanks for everything !!!



PD Pandikumar Duraivel Syncfusion Team December 10, 2021 03:29 PM UTC

Hi Juan, 
 
We are unable to reproduce the mentioned issue at our end with the given details. We have prepared a simple sample for your reference and the same can be downloaded from the below link. 
 
Sample link: 
 
Kindly check this sample if the Excel document is different from your end using issue reproducing Excel document, We suggest you to modify the sample to reproduce the issue and share with us or kindly share with us the Excel document you are using at your end, which will be helpful for us in investigating the query and providing a prompt solution at the earliest 
 
Regards, 
Pandi kumar D. 



JU Juan December 10, 2021 03:52 PM UTC

Thanks.

Here I am sending you an example where you can see that with a number with many decimal places, the pdf is not generated well. 



If I put less decimal places it works fine.

Regads.


Attachment: GettingStarted_Core_b877fa3a.zip


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 13, 2021 12:03 PM UTC

Hi Juan, 

Thanks for sharing the issue reproducing sample. We are checking the query and will get back to you with details tomorrow. (December 14th,2021). 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 14, 2021 02:35 PM UTC

Hi Juan, 

We are able to reproduce the reported issue at our end and validating it currently. We will share the validation details on December 16th,2021. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 16, 2021 02:04 PM UTC

Hi Juan, 
 
We appreciate your patience. 
 
We have confirmed the issue as Color scale conditional format is applied improperly when cell number has more decimal points and logged a defect report. We will include the fix to resolve this issue in our weekly NuGet release scheduled for December 28th,2021. We will let you know once the package is available to download from nuget.org. 

You can track the status of defect report through following feedback link. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 28, 2021 12:29 PM UTC

Hi Juan, 
 
We appreciate your patience. 
 
We have included the fix for  Color scale conditional format is applied improperly when cell number has more decimal points, in our weekly NuGet release version 19.4.0.40. Kindly upgrade the Syncfusion package to this latest version and check and confirm us if the reported issue is resolved at your end. 
 
Regards, 
Keerthi. 



JU Juan December 28, 2021 01:02 PM UTC

Perfect!

Now it works correctly.


Thank you so much for everything !



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 28, 2021 01:34 PM UTC

Hi Juan, 
 
We are glad that the issue is resolved at your end. Kindly let us know if you need any further assistance. 
 
Regards, 
Keerthi.

Loader.
Up arrow icon