public void WriteToWordDocumentContinued(){
m_document = new RadFlowDocument();
m_editor = new RadFlowDocumentEditor(m_document);
Section section = new Section(m_document);
section.HasDifferentFirstPageHeaderFooter = true;
section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(56.69, 94.49, 47.24, 66.14);
m_document.Sections.Add(section);
m_document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.GetHeadingStyleIdByIndex(1));
Style MainTitle = new Style("MainTitle", StyleType.Character) { };
MainTitle.CharacterProperties.UnderlinePattern.LocalValue = UnderlinePattern.Single;
MainTitle.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
MainTitle.CharacterProperties.FontSize.LocalValue = 32;
MainTitle.CharacterProperties.FontWeight.LocalValue = System.Windows.FontWeights.Bold;
m_document.StyleRepository.Add(MainTitle);
Style HeaderParagraphStyle = new Style("HeaderParagraphStyle", StyleType.Paragraph) { };
HeaderParagraphStyle.ParagraphProperties.LineSpacing.LocalValue = 16;
HeaderParagraphStyle.ParagraphProperties.LineSpacingType.LocalValue = HeightType.Exact;
HeaderParagraphStyle.ParagraphProperties.SpacingAfter.LocalValue = 0;
HeaderParagraphStyle.ParagraphProperties.SpacingBefore.LocalValue = 0;
Style HeaderTitleStyle = new Style("HeaderTitleStyle", StyleType.Paragraph) { };
HeaderTitleStyle.ParagraphProperties.LineSpacing.LocalValue = 21.4;
HeaderTitleStyle.ParagraphProperties.LineSpacingType.LocalValue = HeightType.Exact;
HeaderTitleStyle.ParagraphProperties.SpacingAfter.LocalValue = 0;
HeaderTitleStyle.ParagraphProperties.SpacingBefore.LocalValue = 0;
HeaderTitleStyle.ParagraphProperties.TextAlignment.LocalValue = Alignment.Right;
HeaderParagraphStyle.ParagraphProperties.TextAlignment.LocalValue = Alignment.Right;
m_document.StyleRepository.Add(HeaderParagraphStyle);
Style HeaderCharacterStyle = new Style("HeaderCharacterStyle", StyleType.Paragraph) { };
HeaderCharacterStyle.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
HeaderCharacterStyle.CharacterProperties.FontSize.LocalValue = 16;
m_document.StyleRepository.Add(HeaderCharacterStyle);
Style SubTitle = new Style("SubTitle", StyleType.Character) { };
SubTitle.CharacterProperties.UnderlinePattern.LocalValue = UnderlinePattern.Single;
SubTitle.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
SubTitle.CharacterProperties.FontSize.LocalValue = 16;
SubTitle.CharacterProperties.FontWeight.LocalValue = System.Windows.FontWeights.Bold;
m_document.StyleRepository.Add(SubTitle);
Style TopLines = new Style("TopLines", StyleType.Character) { };
TopLines.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
TopLines.CharacterProperties.FontSize.LocalValue = 16;
TopLines.CharacterProperties.FontWeight.LocalValue = System.Windows.FontWeights.Bold;
m_document.StyleRepository.Add(TopLines);
}
This is just minified version of the method where I am trying to instantiate my RadFlowDocument object. This method is being called in a parent class, even If I try to pass RadFlowDocument object from that class, it still causes the UI to break.