Exemplo n.º 1
0
        private void SetupAndInsertSdt(RadFlowDocumentEditor editor, InlineBase inline, string text, SdtType sdtType, DocumentElementBase start = null, DocumentElementBase end = null)
        {
            if (sdtType == SdtType.RepeatingSection)
            {
                editor.MoveToParagraphStart(inline.Paragraph);
            }
            else
            {
                editor.MoveToInlineStart(inline);
            }

            SdtProperties sdt = new SdtProperties(sdtType)
            {
                // All SDTs should not allow deleting them
                Lock = Lock.SdtLocked
            };

            if (!string.IsNullOrEmpty(text))
            {
                // Add a placeholder if text for it is available.
                sdt.Placeholder = new Placeholder()
                {
                    PlaceholderText = text,
                    ShowPlaceholder = true
                };
            }

            if (start == null)
            {
                editor.InsertStructuredDocumentTag(sdt);
            }
            else
            {
                end = end ?? start;
                editor.InsertStructuredDocumentTag(sdt, start, end);
            }
        }
Exemplo n.º 2
0
        private void SkillsSection(RadFlowDocumentEditor editor, Section firstSection)
        {
            Paragraph skillsTitleParagpraph = editor.InsertParagraph();

            skillsTitleParagpraph.StyleId = Heading1StyleId;
            skillsTitleParagpraph.Inlines.AddRun("Skills");

            #region Tool/Technology

            Paragraph skillsContentParagraph = firstSection.Blocks.AddParagraph();
            Run       skillRun = skillsContentParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, skillRun, "Tool/Technology", SdtType.RichText);

            editor.InsertStructuredDocumentTag(SdtType.RepeatingSectionItem, skillsContentParagraph, skillsContentParagraph);
            this.SetupAndInsertSdt(editor, skillsContentParagraph.Inlines.First(), null, SdtType.RepeatingSection, skillsContentParagraph);

            #endregion
        }
Exemplo n.º 3
0
        private void ExperienceSection(RadFlowDocument document, RadFlowDocumentEditor editor, Section firstSection)
        {
            Paragraph experienceTitleParagraph = editor.InsertParagraph();

            experienceTitleParagraph.StyleId = Heading1StyleId;
            experienceTitleParagraph.Inlines.AddRun("Experience");

            #region Title

            Paragraph titleContentParagraph = firstSection.Blocks.AddParagraph();
            Run       titleRun = titleContentParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, titleRun, "Title", SdtType.RichText);

            #endregion


            #region Company Name

            Paragraph companyNameParagraph = firstSection.Blocks.AddParagraph();
            Run       companyRun           = companyNameParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, companyRun, "Company name", SdtType.RichText);

            #endregion


            #region Period

            Paragraph periodParagraph = firstSection.Blocks.AddParagraph();

            Run startDateRun = periodParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, startDateRun, "Select start date", SdtType.Date);

            periodParagraph.Inlines.AddRun(" - ");

            Run endDateRun = periodParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, endDateRun, "Select end date", SdtType.Date);

            #endregion


            #region Company Description

            Paragraph companyDescriptionParagraph = firstSection.Blocks.AddParagraph();
            Run       companyDescriptionRun       = companyDescriptionParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, companyDescriptionRun, "Company Description", SdtType.RichText);

            #region Achievements

            List list = document.Lists.Add(ListTemplateType.BulletDefault);

            Paragraph achievementsParagraph = firstSection.Blocks.AddParagraph();
            achievementsParagraph.ListId = list.Id;
            Run achievementsRun = achievementsParagraph.Inlines.AddRun();
            this.SetupAndInsertSdt(editor, achievementsRun, "What did you achieve in this role?", SdtType.RichText);

            editor.InsertStructuredDocumentTag(SdtType.RepeatingSectionItem, achievementsParagraph, achievementsParagraph);
            this.SetupAndInsertSdt(editor, achievementsParagraph.Inlines.First(), null, SdtType.RepeatingSection, achievementsParagraph);

            #endregion

            #endregion
        }