Formatting of individual characters to bold is not working when saving workbook to pdf

Hi Support,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

When saving a workbook to pdf the formatting of individual characters to bold within a cell is not formatting the string properly. When saving to Xlsx or Xls the string is displayed correctly.

This is the code I use to format the caracters to to bold.

cell.Characters(startIndex, length).Font.IsBold

This is the code I use to save the workbook to pdf.

workbook.Save(this.Response, filename, ContentDisposition.Attachment, new PdfSaveOptions());

I have attaced a screen capture of what the pdf vs xlsx looks like.

Thanks for your help.

Mikael

Hi Mikael,

Please test your issue with latest version

Aspose.Cells for .NET v5.3.1
.

If your problem is still not resolved then provide us your Template/Input excel file, so that we could investigate this issue and fix it for you.

Hello Shakeel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for the prompt response. I have upgraded from 3.5.0 to 3.5.1 but the issue still remains.

I have attached my C# code in a txt file. Apologies for the rather verbose code but as I use the worksheet.AutoFitColumns() and worksheet.Cells.Merge() so I thought it might be worthwhile to mock up the all the columns so the worksheet get the proper layout.

Worth nothing is that I also use the landscape page orientation and the FitToPagesWide setting is enabled in the page setup.

I’m not sure if I should mention that any formulas within the worksheet are not evaluated and the AutoFitColumn does not take the result of the formula into account when saving to pdf.

That may be by design and to me it’s not really a problem as I solved it by evaluating the formulas myself first and do the AutoFitColumn based on the result and then if the save format is xlsx or xls I then overwrite my totals with the formula.

e.g

cell.PutValue(total);

worksheet.AutoFitColumn(cell.Column);

if (saveFormat == SaveFormat.Xlsx || saveFormat == SaveFormat.Excel97To2003)

cell.Formula = formula;

But it would be nice to not have to do this workaround.

Many thanks

Mikael

Hi,

I can reproduce this issue with the latest version Aspose.Cells for .NET 5.3.1.0.

I have attached a screenshot for a reference as well as output files in xlsx and pdf format.

This issue has been logged as CELLSNET-25365.

Hi,

Please try the Aspose.Cells for .NET v5.3.1.1. I have tested using your code with it and it does fix the issue now.

Thank you.

Hi Amjad,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have tested my code with 5.3.1.1 but now the whole cell with the formatted text is omitted from the pdf. I have attached a screen shot.

Kind regards

Mikael

Hi,

It works fine with your previous test.xlsx file as I tested. I think you are using different Excel file. Please post your template Xlsx and output PDF files here, we will check your issue soon.

thank you.

The issues you have found earlier (filed as 25365) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.