How do you change the font size, color, weight, etc. when writing a Microsoft Word document using RadDocumentEditor?
The Word document created has all font in Calibri 6 point normal weight black in Microsoft Word 2010..
It should have different sizes/weights/colors of Calibri and Arial text.
{
RadDocument doc = new RadDocument();
RadDocumentEditor ed = new RadDocumentEditor(doc);
doc.SectionDefaultPageSize = PaperTypeConverter.ToSize(PaperTypes.Letter);
doc.SectionDefaultPageOrientation = PageOrientation.Portrait;
doc.SectionDefaultPageMargin = new Padding(50);
FontFamily fontCalibri = new FontFamily("Calibri");
FontFamily fontArial = new FontFamily("Arial");
ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(8.0);
ed.Insert("Test inserted Calibri");
ed.InsertLineBreak();
ed.ChangeFontFamily(fontArial);
ed.ChangeFontSize(12.0);
ed.Insert("Test inserted Arial");
ed.InsertLineBreak();
ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(15.0);
ed.ChangeFontWeight(FontWeights.Bold);
ed.Insert("Test inserted Calibri 2 bold");
ed.InsertLineBreak();
ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(30.0);
ed.ChangeForeColor(Color.FromRgb(255, 0, 0));
ed.ChangeFontStyle(FontStyles.Italic);
ed.ChangeFontWeight(FontWeights.Bold);
ed.Insert("Test inserted Calibri 2 bold itallic");
ed.InsertLineBreak();
doc.MeasureAndArrangeInDefaultSize();
ExportToWordDocx(doc, "test_report_doc_1.docx");
}
We are using C#, .net 4.5 and Telerik version 2014.2.617.45 of Telerik.Windows.Documents, Documents.Core and Documents.FormatProviders.OpenXmkl
The Word document created has all font in Calibri 6 point normal weight black in Microsoft Word 2010..
It should have different sizes/weights/colors of Calibri and Arial text.
{
RadDocument doc = new RadDocument();
RadDocumentEditor ed = new RadDocumentEditor(doc);
doc.SectionDefaultPageSize = PaperTypeConverter.ToSize(PaperTypes.Letter);
doc.SectionDefaultPageOrientation = PageOrientation.Portrait;
doc.SectionDefaultPageMargin = new Padding(50);
FontFamily fontCalibri = new FontFamily("Calibri");
FontFamily fontArial = new FontFamily("Arial");
ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(8.0);
ed.Insert("Test inserted Calibri");
ed.InsertLineBreak();
ed.ChangeFontFamily(fontArial);
ed.ChangeFontSize(12.0);
ed.Insert("Test inserted Arial");
ed.InsertLineBreak();
ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(15.0);
ed.ChangeFontWeight(FontWeights.Bold);
ed.Insert("Test inserted Calibri 2 bold");
ed.InsertLineBreak();
ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(30.0);
ed.ChangeForeColor(Color.FromRgb(255, 0, 0));
ed.ChangeFontStyle(FontStyles.Italic);
ed.ChangeFontWeight(FontWeights.Bold);
ed.Insert("Test inserted Calibri 2 bold itallic");
ed.InsertLineBreak();
doc.MeasureAndArrangeInDefaultSize();
ExportToWordDocx(doc, "test_report_doc_1.docx");
}
We are using C#, .net 4.5 and Telerik version 2014.2.617.45 of Telerik.Windows.Documents, Documents.Core and Documents.FormatProviders.OpenXmkl