Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using flowdocument Reader to view html. Html have em based font size. I am getting an error while parsing it in xaml. Please let me know how to set the set the 'em' or '%' based font size for flowdocument.

Please help.

Thanks and Regards,
Jaya Joshi
Posted

1 solution

if the code doesn't work:
C#
System.Windows.Markup.XamlReader.Parse(); 


Then try this one:

http://blogs.msdn.com/b/wpfsdk/archive/2006/05/25/606317.aspx[^]
 
Share this answer
 
Comments
jaya_11 21-Mar-12 8:49am    
Thanks for the Reply Shahin.

I am already using the htmltoxaml convertor class. But i am getting the parse exception in this line:

flowDocument = (FlowDocument)XamlReader.Parse(xaml)

Error is: Failed to create fontsize '1.35 em'
Shahin Khorshidnia 21-Mar-12 16:11pm    
But it worked for me!
What's your Xaml code?
jaya_11 22-Mar-12 0:21am    
The xaml is:

"<flowdocument xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Paragraph><run fontsize="1.38em">Introduction</Paragraph>
<Paragraph />
<Paragraph>Introduction</Paragraph>
<Paragraph>
Whether you’re a money management novice<run>The Wall<Paragraph />
<flowdocument>"

and getting error:

'Failed to create a 'FontSize' from the text '1.38em'.'
Shahin Khorshidnia 22-Mar-12 7:36am    
Wrong code or not complite: Because it's not XAML! It seems a html code.

The parameter of "XamlReader.Parse(..." should be in XAML.
And, If all of the Xaml code is it, then the excpetion can not be "Failed to create fontsize '1.35 em", the exception is "The tag 'Paragraph' does not exist in XML namespace" because there is not any "1.35em" in your code.
jaya_11 22-Mar-12 8:47am    
I tried to copy the xaml(converted html to xaml), but its not showing complete xaml. Actually, the line in xaml which throws error is like:

Font size value inside Run tag(in xaml) is 1.35em.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900