Arabic excel with cell length more than 32k is not converting to pdf properly

@Peyton.Xu Will text wrapping issue be resolved in Aspose.Cells in near future?

@Vaidehi123

Currently we can’t find a way to fix it. It may not be fixed in near future.

Thanks for the update @Peyton.Xu

Please note, both evaluation and licensed versions are same (you may download/get from Downloads section or Nuget repos.). The evaluation version becomes licensed when you purchase the license and set the licensing code (at the start of your application/project). See the document on how to set license for Aspose.Cells for .NET APIs.

To purchase the license, navigate to Purchase (menu) or post a query to Sales representative in Aspose.Purchase section.

Thank you @Amjad_Sahi

@Vaidehi123,

You are welcome.

@Peyton.Xu I converted other file with above code and seeing some black lines in converted file. Could you please check it? I have attached excel and converted pdf both in the attachment. Also, attached screen-shot of the issue.

1522217932.zip (161.7 KB)
black-line-issue.PNG (86.0 KB)

@Vaidehi123,

We will be looking into it soon. By the way, I found you used Aspose.Cells for .NET v22.1 to render your Excel file to PDF. Could you please try using Aspose.Cells for .NET v22.1.1, you may get the new fix in the post in the thread. In case, you still find the issue, kindly do share the output PDF by Aspose.Cells for .NET v22.1.1.

@Amjad_Sahi - I tried with 22.1.1 and getting the same issue as above. I have attached the converted file.1522217932.pdf (277.6 KB)

@Vaidehi123,

Thanks for the file.

I have logged your other Excel file to the ticket into our database. We will evaluate it and look into it soon.

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

@Vaidehi123

We can reproduce the issue that cell background becomes black, and logged a ticket with an id “CELLSNET-50328” for your issue. We will look into it soon.

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

Thanks for the update @Peyton.Xu and @Amjad_Sahi

@Vaidehi123,

You are welcome. Also, your issue (logged recently as “CELLSNET-50328”) is fixed now. We will include the fix in our regular (upcoming) release, i.e., Aspose.Cells for .NET v22.2. The next version will be published in the second week of February, 2022.

1 Like

The issues you have found earlier (filed as CELLSNET-50328) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

@Amjad_Sahi There is one more issue in conversion that numeric followed by line item is not visible in converted file. Please refer page 10 & 11 of pdf. Please find files attached below.

1522221182.zip (251.5 KB)

Could you please highlight the issue in screenshot comparing original or expected data (as shown in MS Excel) Vs output PDF (by Aspose.Cells). Moreover, share your exact code that you are using to render to PDF using your attached template file. We will check your issue soon.

@Amjad_Sahi Here is the screen shot of original and converted files. Numbers are not visible before every statements. Original.PNG (20.0 KB)
Converted.PNG (77.3 KB)

Below is the code which we have used.

            string dataDir = System.IO.Path.GetFullPath(@"..\..\");
            Aspose.Cells.License license = new Aspose.Cells.License();
            license.SetLicense(dataDir + "\\Aspose.Total.lic");
            FileFormatInfo fileFormatInfo = FileFormatUtil.DetectFileFormat(pInFile);
            Aspose.Cells.LoadOptions loadOptions;
            if (fileFormatInfo.FileFormatType == FileFormatType.Html)
            {
                Aspose.Cells.HtmlLoadOptions htmlLoadOptions = new Aspose.Cells.HtmlLoadOptions
                {
                    AutoFitColsAndRows = true
                };
                loadOptions = htmlLoadOptions;
            }
            else
            {
                loadOptions = new Aspose.Cells.LoadOptions();
            }
            loadOptions.CheckExcelRestriction = false;
            Workbook workbook = new Workbook(pInFile, loadOptions);
            workbook.Settings.CheckExcelRestriction = false;
            Aspose.Cells.PdfSaveOptions pdfSaveOptions = new Aspose.Cells.PdfSaveOptions();
            // option to set all the columns of excel in one page.
            pdfSaveOptions.AllColumnsInOnePagePerSheet = true;
            pdfSaveOptions.MergeAreas = true;
            /* Retain the structure of original excel */
            pdfSaveOptions.ExportDocumentStructure = true;
            /* Formula calculation for any digit formulla applied in excels */
            /*it is best to call Workbook.CalculateFormula() just before rendering the spreadsheet to PDF. 
           * This ensures  that the formula dependent values are recalculated, and the correct
           * values are rendered in the PDF.*/
            workbook.CalculateFormula();
            /* For custom named range, need below code to display number instead of ## */
            Range[] range = workbook.Worksheets?.GetNamedRanges();
         
           // workbook.Worksheets.get
            if(range != null && range.Length > 0)
            {
                foreach(var r in range)
                {
                    if (!r.Address.Contains(":"))
                    {
                        r.Worksheet.Cells[r.Address].PutValue(r.Value?.ToString());
                    }
                }
            }
            foreach (Worksheet wks in workbook.Worksheets)
            {
               
                foreach (Aspose.Cells.Cell cell in wks.Cells)
                {
                    Style style = cell.GetStyle();
                    /* if cell is numeric, consider its category type as numeric and update the format */
                    if (cell.Type == CellValueType.IsNumeric || cell.Type == CellValueType.IsDateTime)
                    {
                        var updatedValue = cell.DisplayStringValue.Contains("#") ? cell.Value : cell.DisplayStringValue;
                        cell.PutValue(updatedValue.ToString());
                    }
                    style.VerticalAlignment = TextAlignmentType.Center;
                    cell.SetStyle(style);
                }
                wks.PageSetup.PrintArea = "";
                wks.PageSetup.BottomMargin = 1;
                wks.PageSetup.LeftMargin = 1;
                wks.PageSetup.RightMargin = 1;
                wks.PageSetup.TopMargin = 1;
            }
            workbook.Save(pOutFile, pdfSaveOptions);

@Vaidehi123,

Thanks for the screenshots and sample code segment.

Please notice, I am able to reproduce the issue as you mentioned by using your template file to convert to PDF. I found that numeric values or numbers followed by lines are not visible in the converted file. I have logged a separate ticket with an id “CELLSNET-50401” for your issue. We will look into it soon.

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

1 Like

@Vaidehi123,

This is to inform you that your issue (“CELLSNET-50401”) has been resolved. The fix will be included in the release v22.3 which is expected in the second week of March, 2022. You will also be notified once the next release is published.

1 Like

The issues you have found earlier (filed as CELLSNET-50401) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi