pdf which loses its formatting when the calculation is too long

I am using c# code to convert an excel file to a pdf.

I noticed that in my example, it removes the borders in the case box.


Here is my code with the example


     newRelativeFilePath = "input.xlsx";

     System.Globalization.CultureInfo.CurrentCulture =

                System.Globalization.CultureInfo.GetCultureInfo("fr-FR");


     XlsIORendererSettings settings = new XlsIORendererSettings

     {

         EmbedFonts = true

     };


     using (ExcelEngine excelE = new ExcelEngine())

     {

         IApplication application = excelE.Excel;

         application.DefaultVersion = ExcelVersion.Xlsx;


         //Initialize XlsIO renderer.

         XlsIORenderer renderer = new XlsIORenderer();


         using (FileStream excelStream = new FileStream(newRelativeFilePath, FileMode.Open, FileAccess.Read))

         {

             IWorkbook wb = application.Workbooks.Open(excelStream);

             ExcelTemplater.CalculateFormulaForPdf(wb);


             //Convert Excel document with charts into PDF document

             using (PdfDocument pdfDocument = renderer.ConvertToPDF(wb, settings))

             {

                 using (Stream s = new FileStream(newRelativeFilePathPdf, FileMode.Create, FileAccess.ReadWrite))

                 {

                     if (data!.ContainsKey("annexes"))

                     {

                         AddAnnexes(JArray.Parse(data["annexes"].ToString()), pdfDocument);

                     }

                     pdfDocument.Save(s);

                 }

             }

         }

     }


Attachment: 13878_7aa21a31.zip

3 Replies

YV Yaavann Vignesh Sethuraman Syncfusion Team December 4, 2024 06:24 AM UTC

Hi Aitbouhou Adam,

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

Regards,
Yaavann.



YV Yaavann Vignesh Sethuraman Syncfusion Team December 6, 2024 12:01 PM UTC

Hi Aitbouhou Adam,

We have confirmed the issue as "Cell styles loss when the set value to a cell that contains the array formula" and logged a defect report. We will include the fix for this issue in our upcoming weekly NuGet release scheduled for December 24, 2024.

 

You can track the status through the below feedback link:
Feedback: Cell styles loss when the set value to a cell that contains the array formula | ASP.NET CORE 

Regards,
Yaavann.



AH Alex Harson James Henso Syncfusion Team December 24, 2024 07:35 AM UTC

Hi Aitbouhou,

We have included the fix to resolve the issue "Cell styles loss when the set value to a cell that contains the array formula" in our weekly NuGet release version 28.1.36. Kindly upgrade your Syncfusion packages to this new 28.1.36 version and let us know if the issue is resolved.

 

NuGet Package: NuGet Gallery | Syncfusion.XlsIORenderer.Net.Core 28.1.36

 

Root Cause:

When applying a value to a cell that contains an array formula, XlsIO changes the style index to default, which causes the removal of existing styles.

 

Regards,

Alex Harson James H


Loader.
Up arrow icon