I use this code to display html text from sql database in rad editor now i want to paste the text with the color , bold to word document.
The words paste normal as text not with any colors or bold text just plain texted
This is the code what i use.
Paragraph heading3 = new Paragraph();
Run heading_run3 = new Run();
Text heading_text3 = new Text(name);
ParagraphProperties heading_pPr3 = new ParagraphProperties();
// we set the style
heading_pPr3.ParagraphStyleId = new ParagraphStyleId() { Val = "Heading" + num.ToString() };
heading3.Append(heading_pPr3);
heading_run3.Append(heading_text3);
heading3.Append(heading_run3);
wordDoc.MainDocumentPart.Document.Body.Append(heading3);
if (CheckBox1.Checked == true)
{
///Add Proposal Description to Document
string html2 = drvSql["Sales_Description"].ToString();
//string id = drvSql["Treeselectedid"].ToString();
RadEditor2.Content = html2;
string t;
StringWriter sw = new System.IO.StringWriter();
t = RadEditor2.Text;
Paragraph heading2 = new Paragraph();
Run heading_run2 = new Run();
Text heading_text2 = new Text(t);
ParagraphProperties heading_pPr2 = new ParagraphProperties();
//// we set the style
heading_pPr2.ParagraphStyleId = new ParagraphStyleId() { Val = "Indent" + num.ToString() };
heading2.Append(heading_pPr2);
heading_run2.Append(heading_text2);
heading2.Append(heading_run2);
wordDoc.MainDocumentPart.Document.Body.Append(heading2);
}
The words paste normal as text not with any colors or bold text just plain texted
This is the code what i use.
Paragraph heading3 = new Paragraph();
Run heading_run3 = new Run();
Text heading_text3 = new Text(name);
ParagraphProperties heading_pPr3 = new ParagraphProperties();
// we set the style
heading_pPr3.ParagraphStyleId = new ParagraphStyleId() { Val = "Heading" + num.ToString() };
heading3.Append(heading_pPr3);
heading_run3.Append(heading_text3);
heading3.Append(heading_run3);
wordDoc.MainDocumentPart.Document.Body.Append(heading3);
if (CheckBox1.Checked == true)
{
///Add Proposal Description to Document
string html2 = drvSql["Sales_Description"].ToString();
//string id = drvSql["Treeselectedid"].ToString();
RadEditor2.Content = html2;
string t;
StringWriter sw = new System.IO.StringWriter();
t = RadEditor2.Text;
Paragraph heading2 = new Paragraph();
Run heading_run2 = new Run();
Text heading_text2 = new Text(t);
ParagraphProperties heading_pPr2 = new ParagraphProperties();
//// we set the style
heading_pPr2.ParagraphStyleId = new ParagraphStyleId() { Val = "Indent" + num.ToString() };
heading2.Append(heading_pPr2);
heading_run2.Append(heading_text2);
heading2.Append(heading_run2);
wordDoc.MainDocumentPart.Document.Body.Append(heading2);
}