Excel to PDF conversion incorrectly converts a header/footer section that contains a double ampersand (&&)

When using Aspose.Cells.Workbook.Save to convert an Excel file to a PDF, if an Excel header or footer includes a double ampersand (&&) in a section, the output is either correct, incorrect, or throws an exception depending on the content and spacing:

Section Spec Output Header Section<span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(31, 73, 125);”>
Profit && Loss<span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(31, 73, 125);”> Profit & Loss
Profit &&Loss Profit
Profit&&Loss Profit

P && L P & L
P&&L Error: Such header or footer is not supported yet!


Best Regards,
Amy

Hi,

Kindly post your template Excel file(s) (containing your desired headers) and output PDF file regarding the incorrect and throws an exception issues with sample here, we will check your issue soon.

Thank you.

Hi,

Pdf is same as Excel Print Preview.

In Excel Print Preview, 2 ampersands will show as 1 ampersand.

As you can see in the image attached by me, there are 4 “&&&&”, but they are shown as 2 “&&”.

So Pdf is rendered as correct.

Hi,

Please also see the source.xlsx and the output pdf generated by this code.

C#


string filePath=@“F:\Downloads\source.xlsx”;


Workbook wb = new Workbook(filePath);

wb.Save(filePath + “.out.pdf”, SaveFormat.Pdf);

Please note that the exception occurs when there is no space to the left or right of the double ampersands, such as P&&L, whereas P && L renders as P & L correctly.

I have attached an Excel file for your review.

Thank you,

Amy

Hi,

We can now reproduce this issue.

This issue has been logged as CELLSNET-24934.

Hi,

Please try Aspose.Cells for .NET v5.3.0.5, we have fixed your mentioned issue now.

Thank you.

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


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