Good day,
I made a script where I create a model programmatically, and also add an Annotation with rich text in it, containing a web link. This is working fine, the Annotation is created and the link can be clicked. However after saving the model, closing it, and reopening it, the annotation shows only the plain text with the control codes in it. Apparently the “Interpreter = ‘rich’” property is lost after saving the model.
I have attached a small script that creates a model with an annotation. Am I doing something wrong when creating the annotation in the script?
After running the script:
After saving, closing, reopening the model:
Also the properties before and after saving are different (Name, Text, and PlainText):
Before saving:
>> ah = find_system(gcs, 'FindAll', 'on', 'type', 'annotation');
Name: 'This is a test with rich text <br>with a link to a website <br><br>Create annotations programmatically'
Position: [100 100 300 158]
InternalMargins: [0 0 0 0]
HorizontalAlignment: 'left'
Text: 'This is a test with rich text <br>with a link to a website <br><br>Create annotations programmatically'
PlainText: 'This is a test with rich text with a link to a website Create annotations programmatically'
AnnotationType: 'note_annotation'
UseDisplayTextAsClickCallback: 'off'
After saving and reopening:
>> ah = find_system(gcs, 'FindAll', 'on', 'type', 'annotation');
Name: '<html><body>This is a test with rich text <br>with a link to a website <br><br><a href="https://www.mathworks.com/help/simulink/ug/create-an-annotation-programmatically.html">Create annotations programmatically</a></body></html>'
Position: [100 100 300 200]
InternalMargins: [0 0 0 0]
HorizontalAlignment: 'left'
Text: '<html><body>This is a test with rich text <br>with a link to a website <br><br><a href="https://www.mathworks.com/help/simulink/ug/create-an-annotation-programmatically.html">Create annotations programmatically</a></body></html>'
PlainText: 'This is a test with rich text <br>with a link to a website <br><br>Create annotations programmatically'
AnnotationType: 'note_annotation'
UseDisplayTextAsClickCallback: 'off'
It’s a minor issue, but annoying nonetheless. I hope you can help me out here, thanks.