コード例 #1
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var list = new List <Win.Block>();

                if (rdo.PublicationEntities != null && rdo.PublicationEntities.Count > 0)
                {
                    Win.Paragraph pubTitle = new Win.Paragraph(new Win.Run("Publications"));
                    pubTitle.Foreground = rfo.HeaderColorBrush;
                    pubTitle.FontFamily = new FontFamily(rfo.HeaderFontName);
                    pubTitle.FontSize = rfo.HeaderFontSizeWindows;
                    pubTitle.Margin = rfo.HeaderMargin;
                    list.Add(pubTitle);

                    foreach (var item in rdo.PublicationEntities)
                    {
                        Win.Paragraph pItem = new Win.Paragraph();
                        pItem.Inlines.Add(new Win.Run(item.Publication));
                        pItem.FontFamily = new FontFamily(rfo.BodyFontName);
                        pItem.FontSize = rfo.BodyFontSizeWindows;
                        list.Add(pItem);
                    }
                }

                foreach (var item in list)
                {
                    flowDoc.Blocks.Add(item);
                }
            });
        }
コード例 #2
0
        public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
        {
            return(() =>
            {
                if (rdo.PublicationEntities.Count > 0)
                {
                    // Publications label
                    Word.Paragraph pubsLabelPara = wordDoc.Content.Paragraphs.Add();
                    Word.Range r7label = pubsLabelPara.Range;
                    r7label.Text = "Selected Publications";
                    r7label.InsertParagraphAfter();
                    r7label.Font.Name = rfo.HeaderFontName;
                    r7label.Font.Color = rfo.HeaderColorWord;
                    r7label.Font.Size = rfo.HeaderFontSize;

                    // Publication items
                    int numPub = rdo.PublicationEntities.Count;
                    for (int i = 0; i < numPub; i++)
                    {
                        Word.Paragraph pubParagraph = wordDoc.Content.Paragraphs.Add();
                        Word.Range r7 = pubParagraph.Range;
                        r7.Text = rdo.PublicationEntities[i].Publication;
                        r7.InsertParagraphAfter();
                        r7.Font.Name = rfo.BodyFontName;
                        r7.Font.Size = rfo.BodyFontSize;
                        r7.ParagraphFormat.SpaceAfter = 8;
                        r7.ParagraphFormat.SpaceBefore = 8;
                    }
                }
            });
        }
コード例 #3
0
ファイル: EducationSection.cs プロジェクト: dphseven/Vitae
        public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
        {
            return(() =>
            {
                // Education label
                Word.Paragraph educationLabelPara = wordDoc.Content.Paragraphs.Add();
                Word.Range r6label = educationLabelPara.Range;
                r6label.Text = "Education";
                r6label.InsertParagraphAfter();
                r6label.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                r6label.Font.Name = rfo.HeaderFontName;
                r6label.Font.Color = rfo.HeaderColorWord;
                r6label.Font.Size = rfo.HeaderFontSize;

                // Education items
                int numEduc = rdo.EducationEntities.Count;
                for (int i = 0; i < numEduc; i++)
                {
                    Word.Paragraph educParagraph = wordDoc.Content.Paragraphs.Add();
                    Word.Range r6 = educParagraph.Range;
                    r6.Text = rdo.EducationEntities[i].Credential + ", " + rdo.EducationEntities[i].Institution;
                    r6.InsertParagraphAfter();
                    r6.Font.Name = rfo.BodyFontName;
                    r6.Font.Size = rfo.BodyFontSize;
                    r6.ParagraphFormat.SpaceAfter = 8;
                    r6.ParagraphFormat.SpaceBefore = 8;
                }
            });
        }
コード例 #4
0
        public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
        {
            return(() =>
            {
                // Experience label
                Word.Paragraph experienceLabelPara = wordDoc.Content.Paragraphs.Add();
                Word.Range r5label = experienceLabelPara.Range;
                r5label.Text = "Experience";
                r5label.InsertParagraphAfter();
                r5label.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                r5label.Font.Name = rfo.HeaderFontName;
                r5label.Font.Color = rfo.HeaderColorWord;
                r5label.Font.Size = rfo.HeaderFontSize;

                // Experience items
                int numJobs = rdo.ExperienceEntities.Count;
                for (int i = 0; i < numJobs; i++)
                {
                    // Job metadata
                    Word.Paragraph experienceParagraph = wordDoc.Content.Paragraphs.Add();
                    Word.Range r5 = experienceParagraph.Range;
                    r5.Text = rdo.ExperienceEntities[i].Employer + Environment.NewLine +
                              rdo.ExperienceEntities[i].Titles[0] + Environment.NewLine +
                              rdo.ExperienceEntities[i].StartDate + " - " +
                              rdo.ExperienceEntities[i].EndDate;
                    r5.Font.Name = rfo.JobInfoFontName;
                    r5.Font.Color = rfo.JobInfoColorWord;
                    r5.Font.Size = rfo.JobInfoFontSize;
                    r5.ParagraphFormat.SpaceAfter = 0;
                    r5.ParagraphFormat.SpaceBefore = 0;

                    // Add experience details
                    int numDetails = rdo.ExperienceEntities[i].Details.Count;
                    Word.Paragraph detPara = wordDoc.Content.Paragraphs.Add();
                    Word.Range r = detPara.Range;
                    for (int j = 0; j < numDetails; j++)
                    {
                        Word.Paragraph expItemPara = wordDoc.Content.Paragraphs.Add();
                        Word.Range r5Item = expItemPara.Range;
                        r5Item.Text = rdo.ExperienceEntities[i].Details[j];
                        r5Item.InsertParagraphAfter();
                        r5Item.Font.Name = rfo.BodyFontName;
                        r5Item.Font.Size = rfo.BodyFontSize;
                        r5Item.ParagraphFormat.LeftIndent = 20.0F;
                        r5Item.ParagraphFormat.SpaceAfter = 8;
                        r5Item.ParagraphFormat.SpaceBefore = 8;
                    }
                }
            });
        }
コード例 #5
0
ファイル: FullNameSection.cs プロジェクト: dphseven/Vitae
 public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
 {
     return(() =>
     {
         Word.Paragraph fullNamePara = wordDoc.Content.Paragraphs.Add();
         Word.Range r1 = fullNamePara.Range;
         r1.Text = rdo.FullName;
         r1.InsertParagraphAfter();
         r1.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
         r1.Font.Name = rfo.NameFontName;
         r1.Font.Color = rfo.NameColorWord;
         r1.Font.Size = rfo.NameFontSize;
     });
 }
コード例 #6
0
ファイル: FullNameSection.cs プロジェクト: dphseven/Vitae
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var para = new Win.Paragraph(new Win.Run(rdo.FullName));

                para.FontSize = rfo.NameFontSizeWindows;
                para.Foreground = rfo.NameColorBrush;
                para.TextAlignment = TextAlignment.Center;
                para.FontFamily = new FontFamily(rfo.NameFontName);
                para.Margin = rfo.HeaderMargin;

                flowDoc.Blocks.Add(para);
            });
        }
コード例 #7
0
ファイル: ExpertiseSection.cs プロジェクト: dphseven/Vitae
        public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
        {
            return(() =>
            {
                if (rdo.ExpertiseEntities.Count > 0)
                {
                    // Expertise label
                    Word.Paragraph tagLineLabelPara = wordDoc.Content.Paragraphs.Add();
                    Word.Range r4label = tagLineLabelPara.Range;
                    r4label.Text = "Expertise";
                    r4label.InsertParagraphAfter();
                    r4label.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                    r4label.Font.Name = rfo.HeaderFontName;
                    r4label.Font.Color = rfo.HeaderColorWord;
                    r4label.Font.Size = rfo.HeaderFontSize;

                    // Expertise item-headers
                    List <string> cats = rdo.ExpertiseEntities.Select(T => T.Category).Distinct().ToList();
                    for (int i = 0; i < cats.Count; i++)
                    {
                        Word.Paragraph p = wordDoc.Content.Paragraphs.Add();
                        Word.Range r4 = p.Range;
                        r4.Text = cats[i] + ": ";
                        int titleLength = r4.Text.Length;

                        // Insert expertise(s)
                        List <string> exps = rdo.ExpertiseEntities.Where(T => T.Category == cats[i]).Select(T => T.Expertise).ToList();
                        for (int j = 0; j < exps.Count; j++)
                        {
                            r4.Font.Name = rfo.BodyFontName;
                            r4.Font.Size = rfo.BodyFontSize;
                            r4.InsertAfter(exps[j] + " " + '\u2022' + " ");
                        }
                        r4.Text = r4.Text.Remove(r4.Text.Length - 2);

                        Word.Range titleRange = r4.Duplicate;
                        titleRange.MoveEnd(Word.WdUnits.wdCharacter, titleLength - 1 - titleRange.Characters.Count);
                        titleRange.MoveStart(Word.WdUnits.wdCharacter, 0);
                        titleRange.Font.Name = rfo.CategoryFontName;
                        titleRange.Font.Size = rfo.CategoryFontSize;

                        r4.InsertParagraphAfter();
                    }
                }
            });
        }
コード例 #8
0
ファイル: ExpertiseSection.cs プロジェクト: dphseven/Vitae
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var listOfCats = new List <Win.Paragraph>();

                // Add the "Expertise" legend
                if (rdo.ExpertiseEntities.Count > 0)
                {
                    Win.Paragraph header = new Win.Paragraph();
                    header.Inlines.Add("Expertise");

                    header.FontFamily = new FontFamily(rfo.HeaderFontName);
                    header.FontSize = rfo.HeaderFontSizeWindows;
                    header.Foreground = rfo.HeaderColorBrush;
                    header.Margin = rfo.HeaderMargin;

                    listOfCats.Add(header);
                }

                List <string> cats = rdo.ExpertiseEntities.Select(T => T.Category).Distinct().ToList();
                for (int i = 0; i < cats.Count; i++)
                {
                    Win.Paragraph p = new Win.Paragraph();
                    p.Inlines.Add(new Win.Bold(new Win.Run(cats[i] + ": ")));
                    List <string> expItems = rdo.ExpertiseEntities.Where(T => T.Category == cats[i]).Select(T => T.Expertise).ToList();
                    string s = string.Empty;
                    for (int j = 0; j < expItems.Count; j++)
                    {
                        s += (expItems[j] + " " + itemSeparator + " ");
                    }
                    s = s.Remove(s.Length - 3);
                    p.Inlines.Add(s);
                    p.FontFamily = new FontFamily(rfo.BodyFontName);
                    p.FontSize = rfo.BodyFontSizeWindows;
                    listOfCats.Add(p);
                }

                foreach (var item in listOfCats)
                {
                    flowDoc.Blocks.Add(item);
                }
            });
        }
コード例 #9
0
 public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
 {
     return(() =>
     {
         Word.Paragraph basicInfoPara = wordDoc.Content.Paragraphs.Add();
         Word.Table firstTable = wordDoc.Tables.Add(basicInfoPara.Range, 2, 2);
         firstTable.Rows[1].Cells[1].Range.Text = rdo.AddressLine1;
         firstTable.Rows[2].Cells[1].Range.Text = rdo.AddressLine2;
         firstTable.Rows[1].Cells[2].Range.Text = rdo.PhoneNumber;
         firstTable.Rows[2].Cells[2].Range.Text = rdo.Email;
         firstTable.Rows[1].Cells[2].Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
         firstTable.Rows[2].Cells[2].Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
         firstTable.Range.Font.Name = rfo.BodyFontName;
         firstTable.Range.Font.Size = rfo.BodyFontSize;
         firstTable.Range.ParagraphFormat.SpaceAfter = 0;
         firstTable.Range.ParagraphFormat.SpaceBefore = 0;
         firstTable.Borders.Enable = 0;
     });
 }
コード例 #10
0
 public Action AddToWordDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Word.Document wordDoc)
 {
     return(() =>
     {
         if (rdo.TagLine != string.Empty)
         {
             Word.Paragraph tagLinePara = wordDoc.Content.Paragraphs.Add();
             Word.Range r3 = tagLinePara.Range;
             r3.Text = rdo.TagLine;
             r3.InsertParagraphAfter();
             r3.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
             r3.Font.Name = rfo.TagLineFontName;
             r3.Font.Color = rfo.TagLineColorWord;
             r3.Font.Size = rfo.TagLineFontSize;
             r3.ParagraphFormat.SpaceAfter = 12;
             r3.ParagraphFormat.SpaceBefore = 12;
         }
     });
 }
コード例 #11
0
        public void CreateResumeAsPdfFile(
            IResumeDataObject rdo,
            IResumeFormatObject rfo,
            IResumeStructureObject rso,
            string filePathAndName)
        {
            Application wordApp      = new Application();
            var         wordDocument = wordApp.Documents.Add();

            foreach (var item in rso.ResumeSections)
            {
                item.AddToWordDocument(rdo, rfo, wordDocument).DynamicInvoke();
            }

            persister.Persist(wordDocument, filePathAndName, DocumentPersistenceFileType.PDF);

            wordDocument.Close(SaveChanges: false);
            wordDocument = null;
            wordApp.Quit();
            wordApp = null;
        }
コード例 #12
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var table = new Win.Table();
                table.RowGroups.Add(new Win.TableRowGroup());
                var rg = table.RowGroups[0];
                rg.Rows.Add(new Win.TableRow());
                rg.Rows.Add(new Win.TableRow());

                Win.TableCell add1Cell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.AddressLine1)));
                Win.TableCell add2Cell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.AddressLine2)));
                Win.TableCell phoneCell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.Email)));
                Win.TableCell emailCell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.PhoneNumber)));

                rg.Rows[0].Cells.Add(add1Cell);
                rg.Rows[1].Cells.Add(add2Cell);
                rg.Rows[0].Cells.Add(emailCell);
                rg.Rows[1].Cells.Add(phoneCell);

                add1Cell.TextAlignment = TextAlignment.Left;
                add2Cell.TextAlignment = TextAlignment.Left;
                phoneCell.TextAlignment = TextAlignment.Right;
                emailCell.TextAlignment = TextAlignment.Right;

                foreach (var row in rg.Rows)
                {
                    foreach (var cell in row.Cells)
                    {
                        cell.FontFamily = new FontFamily(rfo.BodyFontName);
                        cell.FontSize = rfo.BodyFontSizeWindows;
                    }
                }

                flowDoc.Blocks.Add(table);
            });
        }
コード例 #13
0
        private void UpdateDocumentPreview()
        {
            try
            {
                IResumeDataObject   rdo = CreateRdo();
                IResumeFormatObject rfo = _kernel.Get <IResumeFormatObject>();

                var blks = ResumePreview.Blocks;
                blks.Clear();

                IFullNameSection fns = _kernel.Get <IFullNameSection>();
                fns.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();

                IBasicInfoSection bis = _kernel.Get <IBasicInfoSection>();
                bis.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();

                ITagLineSection tls = _kernel.Get <ITagLineSection>();
                tls.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();

                IExpertiseSection es = _kernel.Get <IExpertiseSection>();
                es.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();

                IExperienceSection xs = _kernel.Get <IExperienceSection>();
                xs.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();

                IEducationSection eds = _kernel.Get <IEducationSection>();
                eds.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();

                IPublicationsSection pubs = _kernel.Get <IPublicationsSection>();
                pubs.AddToFlowDocument(rdo, rfo, ResumePreview).DynamicInvoke();
            }
            catch (Exception e)
            {
                ls.Log(e, "Exception");
            }
        }
コード例 #14
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var list = new List <Win.Block>();

                // "Experience" header
                Win.Paragraph expTitlePara = new Win.Paragraph();
                expTitlePara.Inlines.Add(new Win.Run("Experience"));

                expTitlePara.Margin = new System.Windows.Thickness(0, 20, 0, 20);
                expTitlePara.Foreground = rfo.HeaderColorBrush;
                expTitlePara.FontFamily = new FontFamily(rfo.HeaderFontName);
                expTitlePara.FontSize = rfo.HeaderFontSizeWindows;
                expTitlePara.Margin = rfo.HeaderMargin;

                list.Add(expTitlePara);

                for (int i = 0; i < rdo.ExperienceEntities.Count; i++)
                {
                    var expItem = rdo.ExperienceEntities[i];

                    // Employer Name
                    Win.Paragraph empName = new Win.Paragraph(new Win.Run(expItem.Employer));
                    empName.Foreground = rfo.JobInfoColorBrush;
                    empName.FontFamily = new FontFamily(rfo.JobInfoFontName);
                    empName.FontSize = rfo.JobInfoFontSizeWindows;
                    list.Add(empName);

                    // Title
                    Win.Paragraph title = new Win.Paragraph(new Win.Run(expItem.Titles.FirstOrDefault()));
                    title.Foreground = rfo.JobInfoColorBrush;
                    title.FontFamily = new FontFamily(rfo.JobInfoFontName);
                    title.FontSize = rfo.JobInfoFontSizeWindows;
                    list.Add(title);

                    // Dates
                    Win.Paragraph dates = new Win.Paragraph(new Win.Run(expItem.StartDate + " - " + expItem.EndDate));
                    dates.Foreground = rfo.JobInfoColorBrush;
                    dates.FontFamily = new FontFamily(rfo.JobInfoFontName);
                    dates.FontSize = rfo.JobInfoFontSizeWindows;
                    list.Add(dates);

                    // List of experience items
                    Win.List bullets = new Win.List();
                    for (int j = 0; j < rdo.ExperienceEntities[i].Details.Count; j++)
                    {
                        var item = new Win.ListItem(new Win.Paragraph(new Win.Run(rdo.ExperienceEntities[i].Details[j])));
                        bullets.ListItems.Add(item);
                        item.FontFamily = new FontFamily(rfo.BodyFontName);
                        item.FontSize = rfo.BodyFontSizeWindows;
                        bullets.Margin = bulletMargin;
                        list.Add(bullets);
                    }
                }

                foreach (var item in list)
                {
                    flowDoc.Blocks.Add(item);
                }
            });
        }