Hello dear Aspose team,
We are facing an issue where Aspose.Note does not return the correct hyperlink address for hyperlinks which contain Unicode characters in their address. For those hyperlinks, it simply returns the hyperlink text as hyperlink address, which is not correct.
We have created a sample project to demonstrate this behavior. Please notice that for all the hyperlinks the hyperlink text is being retrieved correctly except the ones which contain Unicode characters.
https://files.axiomint.com/external/file/4ppre888fb7ba258942afbed826d4825e3f49
If you will have difficulties downloading the project, you can simply download the sample file (the forum does not allow attaching files of .one format) and run the following code
public static void Main(string[] args)
{
string filePath = @"Test File\OneNoteTest.one";
using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
{
Document doc = new Document(fileStream);
foreach (var page in doc)
{
IList<RichText> richTexts = page.GetChildNodes<RichText>();
foreach (RichText richText in richTexts)
{
foreach (TextRun textRun in richText.TextRuns)
{
var textStyle = textRun.Style;
if (textStyle.IsHyperlink && !string.IsNullOrWhiteSpace(textStyle.HyperlinkAddress))
{
string linkPath = textStyle.HyperlinkAddress;
string linkText = textRun.Text;
Console.WriteLine($"Link Text: {linkText}");
Console.WriteLine($"Link Path: {linkPath}");
Console.WriteLine("-----------------------");
Console.WriteLine();
}
}
}
}
}
Console.ReadKey();
}
Sample file:
Link 1: OneNoteTest.one
Link 2: OneNoteTest.one - Google Drive