Example #1
0
 private void MovePositonInEditor(RadFlowDocumentEditor editor, RadFlowDocument document)
 {
     #region radwordsprocessing-editing-radflowdocumenteditor_2
     Paragraph firstParagraph = document.EnumerateChildrenOfType <Paragraph>().First();
     editor.MoveToInlineEnd(firstParagraph.Inlines[1]);
     #endregion
 }
Example #2
0
        public static void SaveDocument(RadFlowDocument document, string selectedFromat)
        {
            IFormatProvider<RadFlowDocument> formatProvider = null;
            switch (selectedFromat)
            {
                case "Docx":
                    formatProvider = new DocxFormatProvider();
                    break;
                case "Rtf":
                    formatProvider = new RtfFormatProvider();
                    break;
                case "Txt":
                    formatProvider = new TxtFormatProvider();
                    break;
            }
            if (formatProvider == null)
            {
                return;
            }

            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = String.Format("{0} files|*{1}|All files (*.*)|*.*",
                selectedFromat,
                formatProvider.SupportedExtensions.First());
            dialog.FilterIndex = 1;

            if (dialog.ShowDialog() == true)
            {
                using (var stream = dialog.OpenFile())
                {
                    formatProvider.Export(document, stream);
                }
            }
        }
Example #3
0
 private void CreateRadFlowDocumentEditor()
 {
     #region radwordsprocessing-editing-radflowdocumenteditor_0
     RadFlowDocument       document = new RadFlowDocument();
     RadFlowDocumentEditor editor   = new RadFlowDocumentEditor(document);
     #endregion
 }
Example #4
0
        /// <summary>
        /// Import a file from disk and convert it to an HTML string for use in the Editor
        /// </summary>
        /// <returns>An HTML string that is just the contents of the body tag so the editor can work with them. Returns null to denote an error.</returns>
        public string GetHtmlString()
        {
            try
            {
                // read the file - in this sample a hardcoded path
                string          path     = Path.Combine(Environment.WebRootPath, "JohnGrisham.docx");
                RadFlowDocument document = ReadFile(path);

                // convert the file to HTML
                HtmlFormatProvider provider = new HtmlFormatProvider();
                provider.ExportSettings.StylesExportMode    = StylesExportMode.Inline;
                provider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
                string html = provider.Export(document);

                // get only the <body> contents
                int    bodyStart = html.IndexOf("<body>") + "<body>".Length;
                int    bodyEnd   = html.IndexOf("</body>");
                string body      = html.Substring(bodyStart, bodyEnd - bodyStart);

                return(body);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Example #5
0
        private void OnCreateContract()
        {
            SetFormattedFields();

            Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
            using (Stream input = File.OpenRead(SelectedTemplate))
            {
                document = provider.Import(input);
            }

            // perform Mailmerge

            List <InternshipContractModel> interns = new List <InternshipContractModel>();

            interns.Add(InternshipData);
            RadFlowDocument resultDocument = document.MailMerge(interns);

            // create pdf Filename

            FileInfo fileInfo   = new FileInfo(SelectedTemplate);
            string   fileName   = $"Offerletter for {InternshipData.FirstName} {InternshipData.LastName}.pdf";
            string   outputFile = Path.Combine(fileInfo.DirectoryName, fileName);

            Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfprovider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
            using (Stream output = File.OpenWrite(outputFile))
            {
                pdfprovider.Export(resultDocument, output);
            }

            SelectedFileName = outputFile;
        }
Example #6
0
 private void CreateInlineImage(RadFlowDocument document, Paragraph paragraph)
 {
     #region radwordsprocessing-model-floatingimage_0
     FloatingImage floatingImage = new FloatingImage(document);
     paragraph.Inlines.Add(floatingImage);
     #endregion
 }
Example #7
0
 private void AddInlineImageAtIndex(RadFlowDocument document, Paragraph paragraph)
 {
     #region radwordsprocessing-model-floatingimage_1
     FloatingImage floatingImage = new FloatingImage(document);
     paragraph.Inlines.Insert(0, floatingImage);
     #endregion
 }
Example #8
0
 private void CreateParagraph(RadFlowDocument document, Section section)
 {
     #region radwordsprocessing-model-paragraph_0
     Paragraph paragraph = new Paragraph(document);
     section.Blocks.Add(paragraph);
     #endregion
 }
Example #9
0
 private void InsertParagraph(RadFlowDocument document, Section section)
 {
     #region radwordsprocessing-model-paragraph_1
     Paragraph paragraph = new Paragraph(document);
     section.Blocks.Insert(0, paragraph);
     #endregion
 }
        public void MailMergeWithDynamicDataObject()
        {
            IEnumerable     mailMergeSource = this.GetDynamicMailMergeDataSource();
            RadFlowDocument mergedDocument  = this.MergeTemplateWithData(mailMergeSource);

            this.SaveFile(mergedDocument);
        }
 private void OpenSample()
 {
     using (Stream stream = File.OpenRead(DocumentConverter.sampleDocumentFilePath))
     {
         this.document = new DocxFormatProvider().Import(stream);
     }
 }
        private void Open(string fileName)
        {
            string extension = Path.GetExtension(fileName);
            IFormatProvider <RadFlowDocument> provider = this.providers
                                                         .FirstOrDefault(p => p.SupportedExtensions
                                                                         .Any(e => string.Compare(extension, e, StringComparison.InvariantCultureIgnoreCase) == 0));

            if (provider != null)
            {
                using (Stream stream = File.OpenRead(fileName))
                {
                    try
                    {
                        this.document = provider.Import(stream);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Could not open file.");
                        this.document = null;
                    }
                }
            }
            else
            {
                Console.WriteLine("Could not open file.");
            }
        }
Example #13
0
 private void CreateSection(RadFlowDocument document)
 {
     #region radwordsprocessing-model-section_0
     Section section = new Section(document);
     document.Sections.Add(section);
     #endregion
 }
Example #14
0
 private void ImportFromByteArray(byte[] input)
 {
     #region  radwordsprocessing-formats-and-conversion-docx-docxformatprovider_1
     DocxFormatProvider provider = new DocxFormatProvider();
     RadFlowDocument    document = provider.Import(input);
     #endregion
 }
Example #15
0
 private void CreateTableCell(RadFlowDocument document, TableRow row)
 {
     #region radwordsprocessing-model-tablecell_0
     TableCell cell = new TableCell(document);
     row.Cells.Add(cell);
     #endregion
 }
Example #16
0
 private void CreateTableRow(RadFlowDocument document, Table table)
 {
     #region radwordsprocessing-model-tablerow_0
     TableRow row = new TableRow(document);
     table.Rows.Add(row);
     #endregion
 }
Example #17
0
        private void CreateTableWithContent()
        {
            #region radwordsprocessing-model-table_4
            RadFlowDocument document = new RadFlowDocument();

            Table table = document.Sections.AddSection().Blocks.AddTable();
            document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleName);
            table.StyleId = BuiltInStyleNames.TableGridStyleName;

            ThemableColor cellBackground = new ThemableColor(Colors.Beige);

            for (int i = 0; i < 5; i++)
            {
                TableRow row = table.Rows.AddTableRow();

                for (int j = 0; j < 10; j++)
                {
                    TableCell cell = row.Cells.AddTableCell();
                    cell.Blocks.AddParagraph().Inlines.AddRun(string.Format("Cell {0}, {1}", i, j));
                    cell.Shading.BackgroundColor = cellBackground;
                    cell.PreferredWidth          = new TableWidthUnit(50);
                }
            }
            #endregion
        }
Example #18
0
        public ActionResult SaveEdit(int id, string bodyContentUA, string bodyContentEN, string fileNamePhoto, string mainName, string mainNameEn,
                                     string phone1, string phone2, string phone3, string email, string fbUrl, string googleUrl, string twUrl, string instUrl, string city, string cityEn)
        {
            string             bodyHtml     = HttpUtility.HtmlDecode(bodyContentUA);
            string             bodyHtmlEn   = HttpUtility.HtmlDecode(bodyContentEN);
            HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
            RadFlowDocument    document     = htmlProvider.Import(bodyHtml);
            RadFlowDocument    documentEn   = htmlProvider.Import(bodyHtmlEn);
            var curMamber = context.TeamMembers.FirstOrDefault(x => x.Id == id);

            if (curMamber != null)
            {
                curMamber.City          = city;
                curMamber.CityEn        = cityEn;
                curMamber.Description   = htmlProvider.Export(document);
                curMamber.DescriptionEn = htmlProvider.Export(documentEn);
                curMamber.Email         = email;
                curMamber.Fb            = fbUrl;
                curMamber.Inst          = instUrl;
                curMamber.Google        = googleUrl;
                curMamber.Name          = mainName;
                curMamber.NameEn        = mainNameEn;
                curMamber.Phone1        = phone1;
                curMamber.Phone2        = phone2;
                curMamber.Phone3        = phone3;
                curMamber.Tw            = twUrl;
                curMamber.Photo         = fileNamePhoto;

                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Example #19
0
 private void AddInlineImageAtIndex(RadFlowDocument document, Paragraph paragraph)
 {
     #region radwordsprocessing-model-imageinline_1
     ImageInline imageInline = new ImageInline(document);
     paragraph.Inlines.Insert(0, imageInline);
     #endregion
 }
Example #20
0
 private void CreateInlineImage(RadFlowDocument document, Paragraph paragraph)
 {
     #region radwordsprocessing-model-imageinline_0
     ImageInline imageInline = new ImageInline(document);
     paragraph.Inlines.Add(imageInline);
     #endregion
 }
Example #21
0
        private void MailMergeWithConcreateDataObject(object obj)
        {
            IEnumerable     mailMergeSource = this.GetConcreateMailMergeDataSouce();
            RadFlowDocument mergedDocument  = this.MergeTemplateWithData(mailMergeSource);

            this.SaveFile(mergedDocument);
        }
        /// <summary>
        /// Convert the HTML string to a file, download the generated file in the browser
        /// </summary>
        /// <param name="htmlContent">The HTML content to export</param>
        /// <param name="fileName">The FileName of the downloaded file, its extension is used to fetch the exprot provider</param>
        /// <returns>Returns true if the operation succeeded, false if there was an exception</returns>
        public async Task <bool> ExportAndDownloadHtmlContent(string htmlContent, string fileName)
        {
            try
            {
                // prepare a document with the HTML content that we can use for conversion
                HtmlFormatProvider provider = new HtmlFormatProvider();
                RadFlowDocument    document = provider.Import(htmlContent);

                // get the provider to export and then download the file
                string mimeType;
                IFormatProvider <RadFlowDocument> exportProvider = GetExportFormatProvider(fileName, out mimeType);
                byte[] exportFileBytes = null;
                using (MemoryStream ms = new MemoryStream())
                {
                    exportProvider.Export(document, ms);
                    exportFileBytes = ms.ToArray();
                }

                // download the file in the browser
                await FileDownloader.Save(_js, exportFileBytes, mimeType, fileName);
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Example #23
0
 private void GetHeading1(RadFlowDocument document)
 {
     #region radwordsprocessing-concepts-styles_1
     string heading1StyleId = BuiltInStyleNames.GetHeadingStyleIdByIndex(1);
     Style  heading1Style   = document.StyleRepository.AddBuiltInStyle(heading1StyleId);
     #endregion
 }
Example #24
0
 private void InsertTable(RadFlowDocument document, Section section)
 {
     #region radwordsprocessing-model-table_1
     Table table = new Table(document, 10, 5);
     section.Blocks.Insert(0, table);
     #endregion
 }
Example #25
0
        private RadFlowDocument MergeTemplateWithData(IEnumerable mailMergeSource)
        {
            RadFlowDocument template       = this.CreateMailMergeDocumentTemplate();
            RadFlowDocument mergedDocument = template.MailMerge(mailMergeSource);

            return(mergedDocument);
        }
Example #26
0
        public ActionResult SaveNew(string bodyContentUA, string bodyContentEN, string fileNamePhoto, string mainName, string mainNameEn,
                                    string phone1, string phone2, string phone3, string email, string fbUrl, string googleUrl, string twUrl, string instUrl, string city, string cityEn)
        {
            string             bodyHtml     = HttpUtility.HtmlDecode(bodyContentUA);
            string             bodyHtmlEn   = HttpUtility.HtmlDecode(bodyContentEN);
            HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
            RadFlowDocument    document     = htmlProvider.Import(bodyHtml);
            RadFlowDocument    documentEn   = htmlProvider.Import(bodyHtmlEn);

            using (Context db = new Context())
            {
                db.TeamMembers.Add(new TeamMember
                {
                    City          = city,
                    CityEn        = cityEn,
                    Description   = htmlProvider.Export(document),
                    DescriptionEn = htmlProvider.Export(documentEn),
                    Email         = email,
                    Fb            = fbUrl,
                    Inst          = instUrl,
                    Google        = googleUrl,
                    Name          = mainName,
                    NameEn        = mainNameEn,
                    Phone1        = phone1,
                    Phone2        = phone2,
                    Phone3        = phone3,
                    Tw            = twUrl,
                    Photo         = fileNamePhoto,
                });
                db.SaveChanges();
            }
            return(null);
        }
Example #27
0
        public ActionResult Save(string titleUa, string titleEn, string body, string bodyEn, string detailUrl, string videoUrl, string pic)
        {
            string             bodyHtml     = HttpUtility.HtmlDecode(body);
            string             bodyHtmlEn   = HttpUtility.HtmlDecode(bodyEn);
            HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
            RadFlowDocument    document     = htmlProvider.Import(bodyHtml);
            RadFlowDocument    documentEn   = htmlProvider.Import(bodyHtmlEn);

            using (Context db = new Context())
            {
                db.Newses.Add(new News
                {
                    Title     = titleUa,
                    TitleEn   = titleEn,
                    DateNews  = DateTime.Now,
                    Body      = htmlProvider.Export(document),
                    BodyEn    = htmlProvider.Export(documentEn),
                    DetailUrl = detailUrl,
                    Video     = videoUrl,
                    Picture   = pic
                });
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
        public void Generate()
        {
            RadFlowDocument template = this.OpenSample();
            RadFlowDocument document = this.CreateDocument(template);

            this.Save(document);
        }
Example #29
0
 private void ChangingDocumentTheme(DocumentTheme theme)
 {
     #region radwordsprocessing-concepts-document-themes_6
     RadFlowDocument document = new RadFlowDocument();
     document.Theme = theme;
     #endregion
 }
Example #30
0
 private void ImportFromString(string input)
 {
     #region radwordsprocessing-formats-and-conversion-rtf-rtfformatprovider_1
     RtfFormatProvider provider = new RtfFormatProvider();
     RadFlowDocument   document = provider.Import(input);
     #endregion
 }
Example #31
0
        public ActionResult SaveEdit(int id, string titleUa, string titleEn, string body, string bodyEn, string detailUrl, string videoUrl, string pic)
        {
            string             bodyHtml     = HttpUtility.HtmlDecode(body);
            string             bodyHtmlEn   = HttpUtility.HtmlDecode(bodyEn);
            HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
            RadFlowDocument    document     = htmlProvider.Import(bodyHtml);
            RadFlowDocument    documentEn   = htmlProvider.Import(bodyHtmlEn);

            using (Context db = new Context())
            {
                var news = db.Newses.FirstOrDefault(x => x.NewsId == id);
                if (news != null)
                {
                    news.Title     = titleUa;
                    news.TitleEn   = titleEn;
                    news.DateNews  = DateTime.Now;
                    news.Body      = htmlProvider.Export(document);
                    news.BodyEn    = htmlProvider.Export(documentEn);
                    news.DetailUrl = detailUrl;
                    news.Video     = videoUrl;
                    news.Picture   = pic;
                    db.SaveChanges();
                }
            }

            return(RedirectToAction("Index"));
        }
        private void SaveFile(RadFlowDocument document)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = "Docx File (*.docx)|*.docx";

            if (dialog.ShowDialog() == true)
            {
                using (Stream stream = dialog.OpenFile())
                {
                    DocxFormatProvider formatProvder = new DocxFormatProvider();
                    formatProvder.Export(document, stream);
                }
            }
        }
        private RadFlowDocument CreateDocument()
        {
            RadFlowDocument document = new RadFlowDocument();
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
            editor.ParagraphFormatting.TextAlignment.LocalValue = Alignment.Justified;

            Table bodyTable = editor.InsertTable(1, 2);

            Paragraph paragraphWithText = bodyTable.Rows[0].Cells[0].Blocks.AddParagraph();
            editor.MoveToParagraphStart(paragraphWithText);

            editor.InsertLine("Dear Telerik User,");
            editor.InsertLine("We're happy to introduce the new Telerik RadWordsProcessing component for WPF. High performance library that enables you to read, write and manipulate documents in DOCX, RTF, HTML and plain text format.");

            editor.InsertText("The current beta version comes with full rich-text capabilities including ");
            editor.InsertText("bold, ").FontWeight = FontWeights.Bold;
            editor.InsertText("italic, ").FontStyle = FontStyles.Italic;
            Run underlined = editor.InsertText("underline,");
            underlined.Underline.Pattern = UnderlinePattern.Dotted;
            underlined.Underline.Color = new ThemableColor(Colors.Black);
            editor.InsertText(" font sizes and ").FontSize = 20;
            editor.InsertText("colors ").ForegroundColor = GreenColor;
            editor.InsertLine("as well as text alignment and indentation. Other options include tables, lists, hyperlinks, bookmarks and comments, inline and floating images. Even more sweetness is added by the built-in styles and themes.");

            editor.InsertLine("We hope you'll enjoy RadWordsProcessing as much as we do. Happy coding!");

            editor.InsertParagraph().Spacing.SpacingAfter = 0;
            editor.InsertLine("Regards,");
            editor.InsertHyperlink("Telerik Team ", "http://www.telerik.com", false, "Telerik Site");

            Paragraph paragraphWithImage = bodyTable.Rows[0].Cells[1].Blocks.AddParagraph();
            editor.MoveToParagraphStart(paragraphWithImage);

            using (Stream stream = FileHelper.GetSampleResourceStream("WordsProcessing.png"))
            {
                editor.InsertImageInline(stream, "png", new Size(470, 261));
            }

            return document;
        }
        private RadFlowDocument CreateDocument(RadGridView grid)
        {
            List<GridViewBoundColumnBase> columns = (from c in grid.Columns.OfType<GridViewBoundColumnBase>()
                                                     orderby c.DisplayIndex
                                                     select c).ToList();

            RadFlowDocument document = new RadFlowDocument();
            Table table = document.Sections.AddSection().Blocks.AddTable();
            document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);
            table.StyleId = BuiltInStyleNames.TableGridStyleId;

            int indentColumns = grid.GroupDescriptors.Count;

            // Export header row
            if (grid.ShowColumnHeaders)
            {
                TableRow headerRow = table.Rows.AddTableRow();
                headerRow.RepeatOnEveryPage = this.RepeatHeaderRowOnEveryPage;
                ThemableColor headerBackground = new ThemableColor(this.HeaderRowColor);

                if (grid.GroupDescriptors.Count > 0)
                {
                    this.AddIndentCell(headerRow, indentColumns, headerBackground);
                }

                for (int i = 0; i < columns.Count; i++)
                {
                    TableCell cell = headerRow.Cells.AddTableCell();
                    cell.Shading.BackgroundColor = headerBackground;
                    cell.PreferredWidth = new TableWidthUnit(columns[i].ActualWidth);
                    Run headerRun = cell.Blocks.AddParagraph().Inlines.AddRun(columns[i].UniqueName);
                    headerRun.FontWeight = FontWeights.Bold;
                }
            }

            if (grid.Items.Groups != null)
            {
                int groupDescriptorsCount = grid.GroupDescriptors.Count;
                for (int i = 0; i < grid.Items.Groups.Count; i++)
                {
                    this.AddGroupRow(table, (QueryableCollectionViewGroup)grid.Items.Groups[i], columns, groupDescriptorsCount);
                }
            }
            else
            {
                this.AddDataRows(table, grid.Items, columns, indentColumns);
            }

            document.Sections.First().Blocks.AddParagraph();
            return document;
        }
        private RadFlowDocument CreateMailMergeDocumentTemplate()
        {
            RadFlowDocument document = new RadFlowDocument();
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);

            editor.InsertText("Hello ");
            editor.InsertField("MERGEFIELD FirstName ", "«FirstName»");
            editor.InsertText(" ");
            editor.InsertField("MERGEFIELD LastName ", "«LastName»");
            editor.InsertText(",");

            editor.InsertParagraph();
            editor.InsertParagraph();
            editor.InsertText("On behalf of ");
            editor.InsertField("MERGEFIELD CompanyName ", "«CompanyName»");
            editor.InsertText(", ");
            editor.InsertText("I would like to thank you for the purchase of ");
            editor.InsertField("MERGEFIELD PurchasedItemsCount ", "«PurchasedItemsCount»");
            editor.InsertText(" ");
            editor.InsertField("MERGEFIELD ProductName ", "«ProductName»");
            editor.InsertText(" done by you from us.");

            editor.InsertParagraph();
            editor.InsertText("We are committed to provide you with the highest level of customer satisfaction possible. ");
            editor.InsertText("If for any reasons you have questions or comments please call ");
            editor.InsertField("MERGEFIELD ProductSupportPhone ", "«ProductSupportPhone»");
            editor.InsertText(" ");
            editor.InsertField("MERGEFIELD ProductSupportPhoneAvailability ", "«ProductSupportPhoneAvailability»");
            editor.InsertText(", or email us at ");
            editor.InsertField("MERGEFIELD ProductSupportEmail ", "«ProductSupportEmail»");
            editor.InsertText(".");

            editor.InsertParagraph();
            editor.InsertText("Once again thank you for choosing ");
            editor.InsertField("MERGEFIELD CompanyName ", "«CompanyName»");
            editor.InsertText(".");

            editor.InsertParagraph();
            editor.InsertParagraph();
            editor.InsertText("Sincerely yours,");
            editor.InsertParagraph();
            editor.InsertField("MERGEFIELD SalesRepFirstName ", "«SalesRepFirstName»");
            editor.InsertText(" ");
            editor.InsertField("MERGEFIELD SalesRepLastName ", "«SalesRepLastName»");
            editor.InsertText(",");

            Paragraph paragraph = editor.InsertParagraph();

            FieldInfo fieldInfo = new FieldInfo(document);
            paragraph.Inlines.Add(fieldInfo.Start);
            paragraph.Inlines.AddRun("MERGEFIELD SalesRepTitle ");
            paragraph.Inlines.Add(fieldInfo.Separator);
            paragraph.Inlines.AddRun("«SalesRepTitle» ");
            paragraph.Inlines.Add(fieldInfo.End);

            return document;
        }
        private RadFlowDocument CreateDocument()
        {
            RadFlowDocument document = new RadFlowDocument();
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
            editor.ParagraphFormatting.TextAlignment.LocalValue = Alignment.Justified;

            // Body
            editor.InsertLine("Dear Telerik User,");
            editor.InsertText("We’re happy to introduce the new Telerik RadWordsProcessing component for WPF. High performance library that enables you to read, write and manipulate documents in DOCX, RTF and plain text format. The document model is independent from UI and ");
            Run run = editor.InsertText("does not require");
            run.Underline.Pattern = UnderlinePattern.Single;
            editor.InsertLine(" Microsoft Office.");

            editor.InsertText("The current community preview version comes with full rich-text capabilities including ");
            editor.InsertText("bold, ").FontWeight = FontWeights.Bold;
            editor.InsertText("italic, ").FontStyle = FontStyles.Italic;
            editor.InsertText("underline,").Underline.Pattern = UnderlinePattern.Single;
            editor.InsertText(" font sizes and ").FontSize = 20;
            editor.InsertText("colors ").ForegroundColor = GreenColor;

            editor.InsertLine("as well as text alignment and indentation. Other options include tables, hyperlinks, inline and floating images. Even more sweetness is added by the built-in styles and themes.");

            editor.InsertText("Here at Telerik we strive to provide the best services possible and fulfill all needs you as a customer may have. We would appreciate any feedback you send our way through the ");
            editor.InsertHyperlink("public forums", "http://www.telerik.com/forums", false, "Telerik Forums");
            editor.InsertLine(" or support ticketing system.");

            editor.InsertLine("We hope you’ll enjoy RadWordsProcessing as much as we do. Happy coding!");
            editor.InsertParagraph();
            editor.InsertText("Kind regards,");

            this.CreateSignature(editor);

            this.CreateHeader(editor);

            this.CreateFooter(editor);

            return document;
        }
Example #37
-1
        public static void SaveDocument(RadFlowDocument document, string selectedFormat)
        {
            HtmlFormatProvider formatProvider = new HtmlFormatProvider();

            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = String.Format("{0} files|*{1}|All files (*.*)|*.*",
                selectedFormat,
                formatProvider.SupportedExtensions.First());
            dialog.FilterIndex = 1;

            if (dialog.ShowDialog() == true)
            {
                using (var stream = dialog.OpenFile())
                {
                    formatProvider.Export(document, stream);
                }
            }
        }