We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Comparison of Cells.ClearContents in Aspose.Cells for .NET and MS Excel clear contents


I have a cell which contains a hyperlink and is also formatted.
My goal is to remove the text in the cell and the hyperlink, but leave the formatting untouched.

In Excel, I can use the Clear Contents option in the contextual menu to achieve this.
With Aspose Cells, the method Cells.clearContents only removes the text and I get an empty cell (with the original formatting) which is clickable!
Excel does not allow this - if I only remove the “Text to display” from the hyperlinks properties, Excel replaces it with the link target.

If this behavior is intentional, what is the procedure to achieve my goal?
If I remove the Hyperlink object from the HyperlinkCollection, the formatting goes away too (like the Remove Hyperlink option in Excel).

I’ve attached a small sample which uses Cells 7.0.2 and JDK5.
Workbook wb = new Workbook(“test.xls”);
Worksheet ws = wb.getWorksheets().get(“Sheet1”);
Cells cells = ws.getCells();
cells.clearContents(3, 3, 3, 3); // D4



Yes, I noticed the difference comparing the clearContents with MS Excel’s feature. I have logged a ticket with an id: CELLSJAVA-40024. We will look into it if we can match up with MS Excel.

As a side note, you may try to remove the hyperlink by yourself manually after clearing the contents. e.g
ws.getHyperlinks().removeAt(0); … not sure if it fits your need.

Thank you.


The hyperlinks.removeAt method is good, but it also removes the formatting (which is correct because Excel does it too) so it’s not the best option for our use case.
A proper clearContents would be better.

What is the current status of this issue?



The issue is under process (we are working on the issue), once it is resolved, we will let you know and provide you the fix here.

Thank you


Please try the fixed version (Latest Version), we have fixed the issue regarding clearContents.

Thank you.


This release fixes the issue.


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

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.