Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void RichTextEditor_Loaded(object sender, RoutedEventArgs e)
        {
            // Create a FlowDocument
            FlowDocument mcFlowDoc = new FlowDocument();

            // Create a paragraph with text
            Paragraph para = new Paragraph();
          //  para.Inlines.Add(new Run("Importance:High"));
             para.Inlines.Add(new Run(strImpNote));

            
            para.TextAlignment = TextAlignment.Left;
            para.FontSize = 14;
            para.FontFamily = new FontFamily("Arial");
            para.Inlines.Add(new LineBreak());

            

         //   para.Inlines.Add(new Bold(new Run("Test Bold")));

      
            // Add the paragraph to blocks of paragraph
            mcFlowDoc.Blocks.Add(para);



             string mydocpath =
             Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
             mydocpath = mydocpath.Replace('\\', '/') + "/dailymediaUntitled.png";


            Image image = new Image();
            image.Height =200;
            image.Width = 200;
            BitmapImage bimg = new BitmapImage();
            bimg.BeginInit();
            bimg.UriSource = new Uri(mydocpath, UriKind.Relative);
            bimg.EndInit();
            image.Source = bimg;
             mcFlowDoc.Blocks.Add(new BlockUIContainer(image));


             String str = DateTime.Now.ToString("d MMMM") + " " + DateTime.Now.Year.ToString() + strReportName;

             Paragraph para1 = new Paragraph();
             para1.Inlines.Add(new Run(str));
             para1.TextAlignment = TextAlignment.Left;
             para1.FontSize = 14;
             para1.FontFamily = new FontFamily("Arial");
             para1.Inlines.Add(new LineBreak());


             mcFlowDoc.Blocks.Add(para1);

             String strpres = strPresidentMsg;
             Paragraph para2 = new Paragraph();
             para2.Inlines.Add(new Run(strpres));
             para2.TextAlignment = TextAlignment.Left;
             para2.FontSize = 14;
             para2.FontFamily = new FontFamily("Arial");
             para2.Inlines.Add(new LineBreak());

          
             mcFlowDoc.Blocks.Add(para2);

             String strfoot = strFooterMsg;

             Paragraph para3 = new Paragraph();
             para3.Inlines.Add(new Run(strfoot));
             para3.TextAlignment = TextAlignment.Left;
             para3.FontSize = 14;
             para3.FontFamily = new FontFamily("Arial");
             para3.Inlines.Add(new LineBreak());

          
             mcFlowDoc.Blocks.Add(para3);

//How to convert mcFlowDoc to HTML
}
Posted
Updated 12-Mar-12 2:53am
v2

1 solution

Take a look at this MSDN article Convert XAML to HTML[^]
 
Share this answer
 

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