Wrapping text

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

Wrapping text

Postby richolm » Mon Mar 15, 2021 5:29 pm

Hi

I have CEF sharp (wpf) working great for displaying HTML emails by passing the string using LoadHTML. Sometimes the emails are plain text and while cefsharp does display them it does not wrap the text to the window meaning for some emails you have to scroll a very long way to the right to see all the email. Long text urls are often the cause of this.

(I have googled this but google is obsessed with creating a cefsharp wrapper rather than wrapping text.)

Any help and hints appreciated

Rich
richolm
Newbie
 
Posts: 2
Joined: Mon Mar 15, 2021 5:20 pm

Re: Wrapping text

Postby richolm » Mon Mar 15, 2021 6:40 pm

Posting in case anyone else comes across this, just needed to add this

private void OnBrowserFrameLoadEnd(object sender, FrameLoadEndEventArgs args)
{
if (args.Frame.IsMain)
{
args
.Browser
.MainFrame
.ExecuteJavaScriptAsync(
"document.body.style.wordWrap = 'break-word'");
}
}
richolm
Newbie
 
Posts: 2
Joined: Mon Mar 15, 2021 5:20 pm


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 17 guests