We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

RichTextEditor - Fonts - Default & Different

Thread ID:

Created:

Updated:

Platform:

Replies:

107919 Mar 22,2013 12:10 PM Jul 29,2013 05:13 AM ASP.NET MVC (Classic) 6
loading
Tags: Tools
Chris Skardon
Asked On March 22, 2013 12:10 PM

Is there anyway to
a) Set the default font, so it's not Times New Roman
b) Add my own fonts/remove the existing? as an example - I'd like to get rid of the Times New Roman entirely.

Thanks

Chris

Varalakshmi R.S [Syncfusion]
Replied On March 25, 2013 07:58 AM

Hi Chris,

 

Thanks for contacting Syncfusion forums.

 

Currently we do not provide support to remove the font names from font combo box. However, you can set fonts other than TimesNewRoman by using the following code snippet,

<code>

[Script]

//On load function

$find('RichTextEditor1').IFrame.ExecuteCommand(' fontName', 'Calibri'); // RichTextEditor1 refers control id

</code>

 

Kindly try the above given solution and let us know if this helps.

 

Regards,

Varalakshmi

Chris Skardon
Replied On March 27, 2013 11:10 AM

I'm struggling to get the script to work, I'm using the RichTextEditor in an MVC4 Razor view, like so:


@Html.Syncfusion().RichTextEditor("description").ShowHtmlSource(false).Width(500)

given a <script> </script> tag, what should I put in there? I've tried:
$.find('#description').iframe but that is null...

Thanks

Chris

Halvor Kalleberg
Replied On April 2, 2013 08:52 AM

Did you ever get this to work ? I'm struggling to change the default font too :(.

Varalakshmi R.S [Syncfusion]
Replied On April 5, 2013 12:08 AM

Hi Halvor,

 

We regret for the delay in getting back to you.

 

We have updated our solution for this query in the incident #106477. Kindly refer the above specified incident for better follow up.

 

Regards,

Varalakshmi


Kerry Bennett
Replied On July 23, 2013 02:32 AM

Can you please supply the solution to the above.
I also require the entered text to match with the font styles of the application.

I have tried the jquery in the thread and simialr with no success.

It looks like the stylesheet for the  "RichTextEditor_IFrame" sets the font-family.
But this is not inherited by the document in the IFrame.
So a different approach is required.
I have tried to set the style of the body of the document in the Iframe using jquery,
but have had no success.
It would be good if in future versions the document "body"  in IFrame had an id or a class,
then we could use a style sheet to control the font etc.

 

Varalakshmi R.S [Syncfusion]
Replied On July 29, 2013 05:13 AM

Hi Kerry,

Thanks for the update.

We suggest you to use the below given code to achieve the required functionality. The below given code will the Arial font face with size 2 for IFrame contents.

<code>

[script]

//function

var fontsize = $find('sample_FontSize_DropDown'); // here sample is controlid

var fontstyle = $find('sample_FontStyle_DropDown');

fontsize._textBox.value = 2; // fontsize for display purpose.

fontstyle._textBox.value = 'Arial'; // fontname for display purpose.

var rteobj = $find('sample_IFrame');

var str1 = rteobj.get_Text(); // getting the user text

var strhtml= '<div >'+'<font face="Arial" size="2">'+str1+'</font>'+'</div>'; // Div tag to pass the html source

rteobj.set_HtmlString(strhtml); // passing the Html element to RichTextEditor

</code>

Regards,

Varalakshmi


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;