コード例 #1
1
        private void CreateSignature(RadFlowDocumentEditor editor)
        {
            Table signatureTable = editor.InsertTable(1, 2);
            signatureTable.Rows[0].Cells[0].Borders = new TableCellBorders(
                new Border(BorderStyle.None),
                new Border(BorderStyle.None),
                new Border(4, BorderStyle.Single, GreenColor),
                new Border(BorderStyle.None));

            // Create paragraph with image
            signatureTable.Rows[0].Cells[0].PreferredWidth = new TableWidthUnit(140);
            Paragraph paragraphWithImage = signatureTable.Rows[0].Cells[0].Blocks.AddParagraph();
            paragraphWithImage.Spacing.SpacingAfter = 0;
            editor.MoveToParagraphStart(paragraphWithImage);
            using (Stream stream = FileHelper.GetSampleResourceStream("TelerikLogoSmall.png"))
            {
                editor.InsertImageInline(stream, "png", new Size(118, 42));
            }

            // Create cell with name and position
            signatureTable.Rows[0].Cells[1].PreferredWidth = new TableWidthUnit(140);
            signatureTable.Rows[0].Cells[1].Padding = new Documents.Primitives.Padding(12, 0, 0, 0);
            Paragraph cellParagraph = signatureTable.Rows[0].Cells[1].Blocks.AddParagraph();
            cellParagraph.Spacing.SpacingAfter = 0;
            editor.MoveToParagraphStart(cellParagraph);
            editor.CharacterFormatting.FontSize.LocalValue = 12;

            editor.InsertText("Jane Doe").FontWeight = FontWeights.Bold;
            editor.InsertParagraph().Spacing.SpacingAfter = 0;
            editor.InsertText("Support Officer");
        }
コード例 #2
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
 }
コード例 #3
0
 private void CreateRadFlowDocumentEditor()
 {
     #region radwordsprocessing-editing-radflowdocumenteditor_0
     RadFlowDocument       document = new RadFlowDocument();
     RadFlowDocumentEditor editor   = new RadFlowDocumentEditor(document);
     #endregion
 }
コード例 #4
0
 private void InsertBreak()
 {
     #region radwordsprocessing-model-break_2
     RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());
     Break br = editor.InsertBreak(BreakType.PageBreak);
     #endregion
 }
コード例 #5
0
        private void CreateSignature(RadFlowDocumentEditor editor)
        {
            Table signatureTable = editor.InsertTable(1, 2);

            signatureTable.Rows[0].Cells[0].Borders = new TableCellBorders(
                new Border(BorderStyle.None),
                new Border(BorderStyle.None),
                new Border(4, BorderStyle.Single, greenColor),
                new Border(BorderStyle.None));

            // Create paragraph with image
            signatureTable.Rows[0].Cells[0].PreferredWidth = new TableWidthUnit(140);
            Paragraph paragraphWithImage = signatureTable.Rows[0].Cells[0].Blocks.AddParagraph();

            paragraphWithImage.Spacing.SpacingAfter = 0;
            editor.MoveToParagraphStart(paragraphWithImage);

            using (Stream stream = File.OpenRead(this.sampleDataFolder + "Telerik_logo.png"))
            {
                editor.InsertImageInline(stream, "png", new Size(118, 28));
            }

            // Create cell with name and position
            signatureTable.Rows[0].Cells[1].Padding = new Telerik.Windows.Documents.Primitives.Padding(12, 0, 0, 0);
            Paragraph cellParagraph = signatureTable.Rows[0].Cells[1].Blocks.AddParagraph();

            cellParagraph.Spacing.SpacingAfter = 0;
            editor.MoveToParagraphStart(cellParagraph);
            editor.CharacterFormatting.FontSize.LocalValue = 12;

            editor.InsertText("Jane Doe").FontWeight = FontWeights.Bold;
            editor.InsertParagraph().Spacing.SpacingAfter = 0;
            editor.InsertText("Support Officer");
        }
コード例 #6
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
        private void CreateFields(RadFlowDocumentEditor editor)
        {
            #region radwordsprocessing-concepts-customcodefield_0
            editor.InsertField("PAGE  \\* ROMAN", "VII");
            #endregion

            #region radwordsprocessing-concepts-customcodefield_1
            editor.InsertText("Page ");
            editor.InsertField("PAGE", "3");
            editor.InsertText(" of ");
            editor.InsertField("NUMPAGES", "5");
            #endregion

            #region radwordsprocessing-concepts-customcodefield_2
            //editor.InsertField("DATE  \\@ \"M/d/yy\"", "17/2/14");
            #endregion

            #region radwordsprocessing-concepts-customcodefield_3
            editor.InsertField("AUTHOR  \\* Upper", "JOHN DOE");
            #endregion

            #region radwordsprocessing-concepts-customcodefield_4
            FieldInfo tocField = editor.InsertField("TOC \\o \"1-3\" \\h \\z \\u", "result");
            tocField.IsDirty = true;
            #endregion
        }
コード例 #7
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
 private void CreateTableWithRadFlowDocumentEditor()
 {
     #region radwordsprocessing-model-table_3
     RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());
     Table table = editor.InsertTable(5, 3);
     #endregion
 }
コード例 #8
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
 private void CreateParagraphWithRadFlowDocumentEditor()
 {
     #region radwordsprocessing-model-paragraph_3
     RadFlowDocumentEditor editor    = new RadFlowDocumentEditor(new RadFlowDocument());
     Paragraph             paragraph = editor.InsertParagraph();
     #endregion
 }
コード例 #9
0
        protected Paragraph insertParagraph(RadFlowDocumentEditor editor)
        {
            Paragraph currPar;

            currPar = editor.InsertParagraph();
            currPar.Spacing.SpacingAfter = 0;
            return(currPar);
        }
コード例 #10
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
 private void InsertDateFieldRadFlowDocumentEditor()
 {
     #region radwordsprocessing-concepts-fields_0
     RadFlowDocument       document = new RadFlowDocument();
     RadFlowDocumentEditor editor   = new RadFlowDocumentEditor(document);
     editor.InsertField("DATE", "10/11/2012");
     #endregion
 }
コード例 #11
0
 private void CreateRadFlowDocument()
 {
     #region radwordsprocessing-getting-started_0
     RadFlowDocument       document = new RadFlowDocument();
     RadFlowDocumentEditor editor   = new RadFlowDocumentEditor(document);
     editor.InsertText("Hello world!");
     #endregion
 }
コード例 #12
0
 private void InsertParagraph(RadFlowDocumentEditor editor)
 {
     #region radwordsprocessing-editing-radflowdocumenteditor_5
     editor.InsertText("First paragraph");
     editor.InsertParagraph();
     editor.InsertText("Second paragraph");
     #endregion
 }
コード例 #13
0
        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);
        }
コード例 #14
0
        private RadFlowDocument CreateDocument()
        {
            #region radwordsprocessing-editing-radflowdocumenteditor_3
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());
            editor.InsertText("Hello word!");
            return(editor.Document);

            #endregion
        }
コード例 #15
0
        private void InsertComment2()
        {
            #region radwordsprocessing-model-comment_2
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());

            Run run = editor.InsertText("text");
            editor.InsertComment("My sample comment.", run, run);
            #endregion
        }
        private void CreateFooter(RadFlowDocumentEditor editor)
        {
            Footer    footer    = editor.Document.Sections.First().Footers.Add();
            Paragraph paragraph = footer.Blocks.AddParagraph();

            paragraph.TextAlignment = Alignment.Right;

            editor.MoveToParagraphStart(paragraph);
        }
コード例 #17
0
        private void CreateHeader(RadFlowDocumentEditor editor)
        {
            Header header = editor.Document.Sections.First().Headers.Add();

            editor.MoveToParagraphStart(header.Blocks.AddParagraph());
            using (Stream stream = File.OpenRead(sampleDataFolder + "Telerik_develop_experiences.png"))
            {
                editor.InsertImageInline(stream, "png", new Size(660, 237));
            }
        }
コード例 #18
0
 private void InsertImage(RadFlowDocumentEditor editor)
 {
     #region radwordsprocessing-editing-radflowdocumenteditor_9
     editor.InsertText("Image:");
     using (Stream stream = this.GetResourceStream("Telerik_logo.png"))
     {
         editor.InsertImageInline(stream, "png", new Size(118, 28));
     }
     #endregion
 }
コード例 #19
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
 private void UpdateField()
 {
     #region radwordsprocessing-concepts-fields_2
     RadFlowDocumentEditor editor    = new RadFlowDocumentEditor(new RadFlowDocument());
     FieldInfo             fieldInfo = editor.InsertField("DATE \\@ dd/MM/yyyy", "result");
     Console.WriteLine(fieldInfo.GetResult()); // Output: result
     fieldInfo.UpdateField();
     Console.WriteLine(fieldInfo.GetResult()); // Output: 06/06/2014
     #endregion
 }
コード例 #20
0
        public ReportGenerator(string oTemplatePath)
        {
            DocxFormatProvider provider = new DocxFormatProvider();

            using (Stream input = File.OpenRead(oTemplatePath))
            {
                m_Document = provider.Import(input);
                m_Editor   = new RadFlowDocumentEditor(new RadFlowDocument());
            }
        }
コード例 #21
0
        private void CustomizeBreak()
        {
            #region radwordsprocessing-model-break_3
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());

            Break br = editor.InsertBreak(BreakType.PageBreak);
            br.BreakType = BreakType.LineBreak;
            br.TextWrappingRestartLocation = TextWrappingRestartLocation.NextFullLine;
            #endregion
        }
コード例 #22
0
        private void InsertImageWithRadFlowDocument(RadFlowDocument document)
        {
            #region radwordsprocessing-model-imageinline_3
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);

            using (Stream stream = this.GetResourceStream("Telerik_logo.png"))
            {
                editor.InsertImageInline(stream, "png", new Size(118, 28));
            }
            #endregion
        }
コード例 #23
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
        private void InsertDeleteBookmark()
        {
            #region radwordsprocessing-model-bookmark_1
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());
            Bookmark bookmark            = editor.InsertBookmark("MyBookmark");
            #endregion

            #region radwordsprocessing-model-bookmark_2
            editor.DeleteBookmark("MyBookmark");
            #endregion
        }
コード例 #24
0
        private void ImsertTable(RadFlowDocumentEditor editor, RadFlowDocument document)
        {
            #region radwordsprocessing-editing-radflowdocumenteditor_10
            document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);
            editor.TableFormatting.StyleId = BuiltInStyleNames.TableGridStyleId;

            editor.InsertText("Before table.");
            editor.InsertTable(2, 4);
            editor.InsertText("After table.");
            #endregion
        }
コード例 #25
0
        public CreateClientLetterTelerik(string sourcePath, string saveAsFile, CashFlowInformation information, CashFlowDetail detail)
        {
            this.sourcePath  = sourcePath;
            SaveAsFile       = saveAsFile;
            this.information = information;
            this.detail      = detail;

            FillStrings(detail);
            RadFlowDocument wordDocument = new RadFlowDocument();

            provider = new DocxFormatProvider();

            try
            {
                using (Stream input = File.OpenRead(sourcePath))
                {
                    wordDocument = provider.Import(input);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"Das Word-Template konnte nicht geöffnet werden. {ex.Message}");
            }

            editor = new RadFlowDocumentEditor(wordDocument);
            ReplacePlaceholder(detail);

            int    pos      = saveAsFile.LastIndexOf(".");
            string fileName = saveAsFile.Substring(0, pos) + ".docx";

            using (Stream output = File.OpenWrite(fileName))
            {
                provider.Export(editor.Document, output);
            }



            string pdfFile = fileName.Replace(".docx", ".pdf");

            // cpmversion of a flowdocument to a fixeddocument

            PdfFormatProvider pdfProvider   = new PdfFormatProvider();
            RadFixedDocument  fixedDocument = pdfProvider.ExportToFixedDocument(editor.Document);

            // write the fixeddocuement to file
            Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider fixedProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();


            using (Stream output = File.OpenWrite(pdfFile))
            {
                fixedProvider.Export(fixedDocument, output);
            }
        }
コード例 #26
0
 private void CreateHeader(RadFlowDocumentEditor editor)
 {
     if (this.IncludeHeader)
     {
         Header header = editor.Document.Sections.First().Headers.Add();
         editor.MoveToParagraphStart(header.Blocks.AddParagraph());
         using (Stream stream = FileHelper.GetSampleResourceStream("Telerik_develop_experiences.png"))
         {
             editor.InsertImageInline(stream, "png", new Size(660, 237));
         }
     }
 }
コード例 #27
0
        private void CreateFooter(RadFlowDocumentEditor editor)
        {
            if (this.IncludeFooter)
            {
                Footer    footer    = editor.Document.Sections.First().Footers.Add();
                Paragraph paragraph = footer.Blocks.AddParagraph();
                paragraph.TextAlignment = Alignment.Right;

                editor.MoveToParagraphStart(paragraph);
                editor.InsertHyperlink("telerik.com", "http://www.telerik.com", false, "Telerik Site");
            }
        }
コード例 #28
0
        private void CreateRunhWithRadFlowDocumentEditor()
        {
            #region radwordsprocessing-model-run_3
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());

            // Adds new run to the document
            Run run1 = editor.InsertText("First run ");

            // Adds new run and starts new paragraph
            Run run2 = editor.InsertLine("Second run");
            #endregion
        }
コード例 #29
0
        private RadFlowDocument CreateDocument(RadFlowDocument template)
        {
            RadFlowDocument       document = template;
            RadFlowDocumentEditor editor   = new RadFlowDocumentEditor(document);
            Section firstSection           = document.Sections[0];

            this.PersonalDetailsSection(editor, firstSection);
            this.SummarySection(editor, firstSection);
            this.ExperienceSection(document, editor, firstSection);
            this.SkillsSection(editor, firstSection);

            return(document);
        }
コード例 #30
0
ファイル: UserControl_Cs.cs プロジェクト: qisoftJon/xaml-docs
        private void InsertHyperlinkToBookmark()
        {
            #region radwordsprocessing-concepts-hyperlinks_1
            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());

            // Insert bookmark.
            editor.InsertBookmark("DocumentStart");
            editor.InsertLine("Hello word!");

            // Insert hyperlink pointing to the bookmark.
            editor.InsertHyperlink("Go to start", "DocumentStart", true, "Document start");
            #endregion
        }
コード例 #31
0
        private void InsertFieldInFragment(RadFlowDocumentEditor editor, RadFlowDocument document)
        {
            #region radwordsprocessing-editing-radflowdocumenteditor_7
            // Create header and move the editor
            Header header = document.Sections[0].Headers.Add();
            editor.MoveToParagraphStart(header.Blocks.AddParagraph());

            editor.InsertText("Page ");
            editor.InsertField("PAGE", "1");
            editor.InsertText(" of ");
            editor.InsertField("NUMPAGES", "1");
            #endregion
        }
コード例 #32
0
        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;
        }
コード例 #33
0
 private void CreateHeader(RadFlowDocumentEditor editor)
 {
     if (this.IncludeHeader)
     {
         Header header = editor.Document.Sections.First().Headers.Add();
         editor.MoveToParagraphStart(header.Blocks.AddParagraph());
         using (Stream stream = FileHelper.GetSampleResourceStream("TelerikLogo.png"))
         {
             editor.InsertImageInline(stream, "png", new Size(660, 265));
         }
     }
 }
コード例 #34
0
        private void CreateFooter(RadFlowDocumentEditor editor)
        {
            if (this.IncludeFooter)
            {
                Footer footer = editor.Document.Sections.First().Footers.Add();
                Paragraph paragraph = footer.Blocks.AddParagraph();
                paragraph.TextAlignment = Alignment.Right;

                editor.MoveToParagraphStart(paragraph);
                editor.InsertHyperlink("telerik.com", "http://www.telerik.com", false, "Telerik Site");
            }
        }
コード例 #35
0
        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;
        }
コード例 #36
0
        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;
        }
コード例 #37
0
        private void ReplaceText()
        {
            if(string.IsNullOrEmpty(this.FindWhat))
            {
                return;
            }

            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(this.Document);

            if (this.useRegex)
            {
                Regex oldTextRegex = new Regex(this.FindWhat);
                editor.ReplaceText(oldTextRegex, this.ReplaceWith);
            }
            else
            {
                editor.ReplaceText(this.FindWhat, this.ReplaceWith, this.MatchCase, this.MatchWholeWord);
            }
        }
コード例 #38
0
        private void ReplaceStyling()
        {
            if(string.IsNullOrEmpty(this.StylingFindWhat))
            {
                return;
            }

            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(this.Document);

            if (this.useRegex)
            {
                Regex searchedTextRegex = new Regex(this.StylingFindWhat);
                editor.ReplaceStyling(searchedTextRegex, properties => properties.HighlightColor.LocalValue = Colors.Yellow);
            }
            else
            {
                editor.ReplaceStyling(this.StylingFindWhat, this.MatchCase, this.MatchWholeWord, properties => properties.HighlightColor.LocalValue = Colors.Yellow);
            }
        }