I am working on an iOS iPadOS project which will take in existing text if it exists and import into a MyScript view as formatted text. There I want to be able to add emphasis such as bold underline and italics as well as adding more notes.
What is the best way to get an NSAttributedString into a “Text Document”?
Best Answer
G
Gwenaelle @MyScript
said
over 2 years ago
If you import raw Text in a Text part, you might apply some styling on your editor by setting a theme on it before importing the text, such as changing the color or font-style like for instance ".text {font-family:courier ; font-style: italic; color: #009900; }" This would be quite limited, though.
To answer the question of what I hope to achieve I want to take in a paragraph or more, with bold, italic, underline formatting. The. I want to be able to highlight it and add other emphasis and export it back to a rich text View
G
Gwenaelle @MyScript
said
over 2 years ago
Hello James,
Thank you for your update.
What do you mean by importing formatted text? What would be the source of your formatted text?
Best regards,
Gwenaëlle
J
James Sumners
said
over 2 years ago
I am speaking of NSAttributedString or Rich Text. I am hoping I can figure a way to keep at least some of the formatting and import it or style it. But I haven't figured out quite how to style the text I have imported. Since opening this thread I have been reading your documentation but not doing any specific work on solving the problem. The main things I want to be able to keep as I import text would be bold, italic, underline.
example:
This some text with an emphasis in bold, italic, underline
G
Gwenaelle @MyScript
said
over 2 years ago
Answer
If you import raw Text in a Text part, you might apply some styling on your editor by setting a theme on it before importing the text, such as changing the color or font-style like for instance ".text {font-family:courier ; font-style: italic; color: #009900; }" This would be quite limited, though.
James Sumners
If you import raw Text in a Text part, you might apply some styling on your editor by setting a theme on it before importing the text, such as changing the color or font-style like for instance ".text {font-family:courier ; font-style: italic; color: #009900; }"
This would be quite limited, though.
Best regards,
Gwenaëlle
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstOlivier @MyScript
Dear James,
thank you for contacting us.
Currently, it is not possible to import pre-formatted text. You can only import text adding a Text block (see the addBlock function: https://developer.myscript.com/refguides/interactive-ink/android/1.3/com/myscript/iink/Editor.html#addBlock-float-float-java.lang.String-com.myscript.iink.MimeType-java.lang.String-).
Best regars,
Olivier
James Sumners
Would it be possible to import the text and then format it using?
Olivier @MyScript
Dear James,
Currently, without knowing what you want to achieve, it is difficult to provide with an accurate answer.
Indeed, the API by itself is rather limited, but you can play with the Styling references, and see if it matches your expectation: https://developer.myscript.com/docs/interactive-ink/1.3/reference/styling/#text
Best regards,
Olivier
James Sumners
Gwenaelle @MyScript
Hello James,
Thank you for your update.
What do you mean by importing formatted text? What would be the source of your formatted text?
Best regards,
Gwenaëlle
James Sumners
I am speaking of NSAttributedString or Rich Text. I am hoping I can figure a way to keep at least some of the formatting and import it or style it. But I haven't figured out quite how to style the text I have imported. Since opening this thread I have been reading your documentation but not doing any specific work on solving the problem. The main things I want to be able to keep as I import text would be bold, italic, underline.
example:
This some text with an emphasis in bold, italic, underline
Gwenaelle @MyScript
If you import raw Text in a Text part, you might apply some styling on your editor by setting a theme on it before importing the text, such as changing the color or font-style like for instance ".text {font-family:courier ; font-style: italic; color: #009900; }"
This would be quite limited, though.
Best regards,
Gwenaëlle