Annotate a worksheet by using comments

Hi Team,

Iam using “aspose 7.7.0”(Java) to create XLS from CSV.

I want to add a comment/Note to a column heading to provide guidance on data that a user should enter.

Kindly refer this page:

Microsoft Support

Is there any method to do this with aspose while creating xls from csv?

Awaiting for your response

Thanks
Farhana Y




Hi Farhana,

Thanks for your posting and using Aspose.Cells.

You can add comments inside any cell using Aspose.Cells. Please see the following documentation article for your reference.


Let us know if you encounter any other issue, we will look into it and help you asap.

yes it works thank you so much :slight_smile:

Hi,


Good to know that it helps you to accomplish your tasks. 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.

Thank you.

Hello,

I use the bellow code to add comments.

TxtLoadOptions opts = new TxtLoadOptions(LoadFormat.CSV);
opts.setSeparator(’,’);
opts.setEncoding(Encoding.getDefault());
Workbook newWB = new Workbook(newFile.getAbsolutePath(), opts); //newFile in a csv file object
Worksheet newSheet = newWB.getWorksheets().get(0);
Cells tempCells = newSheet.getCells();
//need to add comment for the cells in the first row.
Row r = tempCells.getRows().get(0); // first row
for(int k=0;k<coldesc.length;k++) //coldesc is a string array contains the comments to be added.
{
Cell c = r.get(k);
int commentIndex = newSheet.getComments().add(c.getName());
Comment comment = newSheet.getComments().get(commentIndex);
comment.setNote(coldesc[k]);
}

As the result of the above code, the proper comment got added in the desired cells. as i want.

But, when i mouse over to a cell, it just blinks for a few seconds and goes off even the mouse hovered to cell.

When i manualy create a comment for a cell using the excel(open office,microsoft excel, etc). that comment will be shown until i mouse out from that cell.

Is there any thing i did wrong with the code?

Kindly let me know.

I have attached the resultant file

Thanks
Farhana Y

Hi Farhana,


Thank you for contacting Aspose support.

We have checked your provided spreadsheet (seems to be the output of your process) against different versions of MS Excel application. Unfortunately, we are unable to replicate the behavior as mentioned in your post when sample.xls file is loaded with Excel 2007 & 2010, that is; the comments stay visible till the mouse hovers over the relevant cell.

We would request you to please give the latest version of Aspose.Cells for Java 8.0.2.3 a try on your end. In case the problem persists, please provide us the input file along with your environment details so we could properly evaluate the problem cause to suggest a solution.

Please note, we are interested in the following details,
  1. Operating System version
  2. Operating System Architecture (32bit/64bit)
  3. MS Excel version
  4. JDK type & version (please use the command java -version on console)

Hello Team,

I have a problem when viewing the XLSX file in LibreOffice Calc. which is created from a CSV with comments added in the first row. (This is not a problem in openOffice or MicrosoftExcel the comment were shown properly).

I use LibreOffice 3.5 in ubuntu 12. i have attached the sample.xlsx file and the screen shot of the problem.

Kindly check the same, And tell any work arround to overcome this issue.

Thanks in advance.

Farhana Y

Hi Farhana,


Thank you for writing back.

I am sure you are aware of the fact that XLSX file format is not the LibreOffice Calc’s native format therefore the behavior as exhibited in your provided snapshot may not be relevant to the Aspose.Cells API. Anyway, we will check the presented scenario on Ubuntu with LibreOffice, and shortly get back to you with more updates in this regard. Please spare us little time to simulate the required environment for testing purposes.

Hi Farhana,


Thank you for your patience with us.

We have checked your provided sample spreadsheet on Ubuntu 12.04.3 with LibreOffice’s 3.5.1, and we are able to see the problem with comments on the spreadsheet. Please note, the comments are visible at all times without clicking/hovering over the relevant cells when spreadsheet is loaded with Calc application. However, we were unable to establish the aforesaid behavior as a bug on the part of Aspose.Cells APIs. Reason being, Aspose.Cells APIs follow MS Excel guidelines & specifications in its implementation, and you have experienced yourself that the MS Excel application behaves correctly when Aspose.Cells generated spreadsheet is loaded with it. Moreover, we have found some threads on 3rd party forums where people have complained about the same behavior with LibreOffice’s Calc application when MS Excel generated spreadsheets with comments behave differently. One of such thread is as follow,
http://en.libreofficeforum.org/node/2811

Anyway, we are moving forward to test the same on recent releases of LibreOffice (4.x.x) in order to confirm if the presented scenario is their bug then it should be fixed in later releases. We will keep you posted with updates in this regard.