Aspose .Net not able to print notes

Hi,

I am not able to find out where in your API to show notes to be saved. Please see image of what I see in Excel. Is this available? If not, will it be soon?

My end result is to save these out in pdf documents. (like a in line comment used to work in Excel).

image.png (20.3 KB)

Thanks,
Charles

@ccuster68,

WorkSheet.PageSetup.PrintComments can be used to print notes in PDF. You may please give a try to the sample code in the following article and share your feedback.

Print Comments while saving to PDF

Hi @ahsaniqbalsidiqui

Here is my sample. I forgot to send it to you on my first post.

Excel_Comments_PrintInPlace.zip (27.5 KB)

Thanks

I think what it comes down to, is Microsoft has a new concept called threaded comments and notes. Here is an article for your reference.

@ccuster68,
I have tested this scenario using your sample file and observed that it prints threaded comments in PDF. Could you please test it with the latest version Aspose.Cells for .NET 19.4.0? I have modified the sample file and added two comments more in the threaded comments and printed the PDF which is attached here for your reference. Please check it and if find some issue, please provide details along with the snapshots. Also provide us the expected PDF created from Excel for our reference.
SuperSheet.xlsx.pdf (22.2 KB)

@ahsaniqbalsidiqui

If you open the document in MS Excel > Review > Notes > Show All Notes > File > Print > Page Setup > Sheet > Comments > As displayed on sheet. You will see the expected output.

I am using code I attached in previous post, but do not get the in line comment/note.

expectedOutput.pdf (290.5 KB)

Additionally, the output is different if you choose to show comments below. Here is how MS outputs it:
expectedOutput2.pdf (319.6 KB)
and this is from Aspose:
output2.pdf (23.7 KB)

Notice the missing date and the extra information explaining versions used.

Thanks,
Charles

@ccuster68,
Could you please explain which Excel and OS are you using for testing? Using Excel 365 in Windows, if I print the comments at the end of file, it generates exactly the same output as Aspose.Cells, shared by me in the previous post here. It means in case of “At end of sheet” Aspose.Cells mimics the behavior of Excel365 in Windows.

For second options “As displayed on sheet”, it creates following output except the yellow color is missing. You may please provide us your environment details and we will provide our feedback after analyzing the information.
outputPrintInPlace.pdf (30.0 KB)

@ccuster68

We have investigated it bit more. Please use the following code:

Workbook workbook = new Workbook(srcFile);
// comments
foreach (Worksheet worksheet in workbook.Worksheets)
{
    //as File > Print > Page Setup > Sheet > Comments > As displayed on sheet    
    worksheet.PageSetup.PrintComments = PrintCommentsType.PrintInPlace;
    //As descirbed in https://support.office.com/en-us/article/the-difference-between-threaded-comments-and-notes-75a51eec-4092-42ab-abf8-7669077b7be3
    //Notes (formerly called "comments" in earlier versions of Excel) don't have a Reply box.    
    //as Review > Notes > Show All Notes    foreach(Comment comment in worksheet.Comments)
    {
        //show all notes, not ThreadComment.
        if (comment.ThreadedComments.Count <= 0)
        {
            comment.IsVisible = true;
        }
    }
}
var saveOptions = new PdfSaveOptions(SaveFormat.Pdf);
workbook.Save(outFile.pdf, saveOptions)

The key point is: Notes (formerly called “comments” in earlier versions of Excel) do not have a Reply box so we just set Notes (not include ThreadComment) to visible.

Thank you @ahsaniqbalsidiqui

That is what I was looking for.

@ccuster68,

Good to know that your issue is sorted out by the suggested code segment. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.