Please notice, I am able to reproduce the issue as you mentioned by using your template file. I found an exception “Index was outside the bounds of the array” when saving XLSX with comments to PDF format. Since you are using MemoryPreference mode (while loading the file) but you are shifting comments to the end of the sheet (via code), so the exception might occur. To get best results for MemoryPreference mode, you should not disturb/shift the data, objects or contents in rows and columns. I think, you may easily cope with it by not using MemoryPreference mode while loading the file rather specify the mode before shifting the comments. See the sample code segment for your reference:
var workbook = new Aspose.Cells.Workbook(“e:\test2\input.xlsx”);
workbook.Settings.MemorySetting = MemorySetting.MemoryPreference;
foreach (Worksheet sheet in workbook.Worksheets)
sheet.PageSetup.PrintComments = Aspose.Cells.PrintCommentsType.PrintSheetEnd;
The above workaround will fix your issue.
Anyways, to investigate your issue in details and to figure it out, we have also logged a ticket with an id “CELLSNET-48048” for your issue. We will look into it to resolve it soon.
Once we have an update on it, we will let you know.