I want to create a new RadDocument and serialize it to byte array. And I want to set default font to something else than "Verdana". Let's use "Comic Sans MS" size 24 for instance. What should I do between "new RadDocument()" and "RtfFormatProvider.Export" (also "XamlFormatProvider.Export") so that word "Verdana" is not found in serialized byte array?
Also, when I want to deserialize this byte array into RadDocument are there some extra steps I should do to prevent Verdana from somehow creeping back in (unless the user explicitly changes some text to Verdana)?
5 Answers, 1 is accepted
After creating the document change the properties of the "Normal" style. Here is the code:
I hope this will be useful. Let me know if you have additional questions.
So I have to use RadDocumentEditor, right. The code makes the default font for new spans, but Verdana remains in both .xaml nad .rtf file as some kind of underlying default font (in xaml file at XPath /t:RadDocument/t:RadDocument.Styles/s:StyleDefinition[@DisplayName="defaultDocumentStyle"]/s:StyleDefinition.SpanStyle/s:SpanProperties/@FontFamily)
It feels unsettling to have that Verdana value lingering there. Will it be ignored in all use cases? Here is the code used for testing:
This appears to be a style that is used for RightToLeft text. You can change it as well:
Should you have any other questions do not hesitate to ask.
I have investigated this and it appears that the font comes from the table element style. By default, this style will be overridden by the "Normal" style and the Verdana font will not appear in the document. It is safe to ignore this setting in this case.
I hope this will be useful.