Annotations with rich text corrupted after saving model
Mostrar comentarios más antiguos
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');
>> get( ah )
Path: 'ann_test'
Name: 'This is a test with rich text <br>with a link to a website <br><br>Create annotations programmatically'
Tag: ''
Description: ''
Type: 'annotation'
Parent: 'ann_test'
Handle: 2.0011
HiliteAncestors: 'none'
RequirementInfo: ''
FontName: 'auto'
FontSize: 12
FontWeight: 'auto'
FontAngle: 'auto'
Selected: 'off'
Position: [100 100 300 158]
InternalMargins: [0 0 0 0]
IsImage: 'off'
FixedHeight: 'off'
FixedWidth: 'on'
HorizontalAlignment: 'left'
VerticalAlignment: 'top'
ForegroundColor: 'black'
BackgroundColor: 'white'
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'
DropShadow: 'on'
AnnotationType: 'note_annotation'
Interpreter: 'rich'
TeXMode: 'off'
ShowInLibBrowser: 'off'
MarkupType: 'model'
ClickFcn: ''
LoadFcn: ''
DeleteFcn: ''
UseDisplayTextAsClickCallback: 'off'
UserData: []
After saving and reopening:
>> ah = find_system(gcs, 'FindAll', 'on', 'type', 'annotation');
>> get( ah )
Path: 'ann_test'
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>'
Tag: ''
Description: ''
Type: 'annotation'
Parent: 'ann_test'
Handle: 2.0012
HiliteAncestors: 'none'
RequirementInfo: ''
FontName: 'auto'
FontSize: 12
FontWeight: 'auto'
FontAngle: 'auto'
Selected: 'off'
Position: [100 100 300 200]
InternalMargins: [0 0 0 0]
IsImage: 'off'
FixedHeight: 'off'
FixedWidth: 'on'
HorizontalAlignment: 'left'
VerticalAlignment: 'top'
ForegroundColor: 'black'
BackgroundColor: 'white'
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'
DropShadow: 'on'
AnnotationType: 'note_annotation'
Interpreter: 'rich'
TeXMode: 'off'
ShowInLibBrowser: 'off'
MarkupType: 'model'
ClickFcn: ''
LoadFcn: ''
DeleteFcn: ''
UseDisplayTextAsClickCallback: 'off'
UserData: []
It’s a minor issue, but annoying nonetheless. I hope you can help me out here, thanks.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Cell Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!