Hyperlink Formatting lost after new Text

Hello, we have the following problem using Aspose Cells 18.03 for Java.

Having a simple document (Document.xlsx) with a link, the link is formatted in this example cursive.
After running the application and setting a new text for the link, the formatting is lost (DocumentNew.xlsx).

How do I keep the formatting?

issue4.zip (13.0 KB)

	public static void main(String[] args) {
		try {
			com.aspose.cells.License wordsLicense = new com.aspose.cells.License();
			InputStream lisenseStream = new FileInputStream("Aspose.Total.Java.lic");
			wordsLicense.setLicense(lisenseStream);
			lisenseStream.close();

			String base = "issue4/";

			InputStream inputStream = new FileInputStream(base + "Document.xlsx");
			Workbook document = new Workbook(inputStream);
			inputStream.close();

			WorksheetCollection worksheets = document.getWorksheets();
			for (int i = 0; i < worksheets.getCount(); i++) {
				Worksheet worksheet = worksheets.get(i);
				HyperlinkCollection hyperlinks = worksheet.getHyperlinks();
				for (int a = 0; a < hyperlinks.getCount(); a++) {
					Hyperlink hyperlink = hyperlinks.get(a);
					hyperlink.setTextToDisplay("NEW TEXT");
				}
			}

			document.save(base + "DocumentNew.xlsx", SaveFormat.XLSX);
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}

@peter.henzler.qualis

Thanks for using Aspose APIs.

We have looked into this issue and found that it is Microsoft Excel behavior. Please see the following screenshot for a reference. The screenshot explains when you change the text to display of hyperlink, hyperlink formatting is lost.

Screenshot:

Hello,

I just had a customer complaining about the same issue, I told him this is Microsoft Excel behavior.
He said “No, Microsoft Excel behavior falls back to the format configured as template”.

The customer was right, see the following printscreen:
Excel.PNG (58.4 KB)

After setting the format template for “Link” and changing the link text, the formatting from the template stays intact.

I tested with the current Aspose.Cells 18.8 version and the following document:
Document.zip (6.4 KB)

@phe,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42722 - Hyperlink text formatting lost when new text is set

@phe,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42722”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@phe,

Please try our latest version/fix: Aspose.Cells for Java v18.9.1 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells for Java v18.9.1.zip (6.3 MB)

I can’t download the file:

“Sorry, this file is private. Only visible to topic owner and staff members.”

@phe,

Since you are not the owner of the thread, so might not download the attachments. Could you provide us your email id, we will post the fix at your mentioned email id as attachment.

hmm strange, I’m the owner of the thread. Looks like I have two accounts, could that happen because of renaming the loginname? Or a migration issue?

Could you merge the two accounts?

@phe,

We have an issue with downloading attachments for some users now, we will try to fix it soon.

I have mailed you the fix at your mentioned email id.

This solves the issue, thank you.

@phe,

Good to know that your issue is sorted out by the new fix/version. 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.

The issues you have found earlier (filed as CELLSJAVA-42722) have been fixed in Aspose.Cells for Java 18.10. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: Installation|Documentation

This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi