예제 #1
0
        public static WordDocument AddObjective(this WordDocument source, Objective objective)
        {
            Table table = new Table(StandardBorderStyle.None);

            TableGrid grid = new TableGrid();

            grid.Columns.Add(new TableGridColumn(Defaults.LargeCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            grid.Columns.Add(new TableGridColumn(Defaults.SmallCellWidth));
            table.Grid = grid;

            var r1 = new Row().ProcessRow(true);
            var r2 = new Row().ProcessRow(false, true);
            var r3 = new Row().ProcessRow(false, false, true);
            var r4 = new Row().ProcessRow(false, false, false, true);

            //r2.Height = new RowHeight(HeightRule.Exact, 300);
            //r3.Height = new RowHeight(HeightRule.Exact, 400);
            //r4.Height = new RowHeight(HeightRule.Exact, 400);

            if (r1.Content[0] is Cell cell)
            {
                cell.Add(WordFactory.Paragraph(WordFactory.Text(objective.ToStatement(), 20)));
                cell.LeftMarginException   = new Width(TableWidthUnit.Point, 100);
                cell.TopMarginException    = new Width(TableWidthUnit.Point, 100);
                cell.BottomMarginException = new Width(TableWidthUnit.Point, 100);
                cell.RightMarginException  = new Width(TableWidthUnit.Point, 100);
            }

            table = table.AddRow(r1, r2, r3, r4);

            source.Body.Add(table);

            source.Body.Add(WordFactory.Paragraph());

            return(source);
        }
예제 #2
0
        public static Row ProcessRow(this Row source, bool first = false, bool second = false, bool third = false, bool fourth = false)
        {
            for (int i = 0; i < 11; i++)
            {
                var cell = new Cell().SetCell();

                source.Add(cell);

                switch (i)
                {
                case 0:
                    cell.Width = new Width(TableWidthUnit.Point, 12000);
                    cell.VerticallyMergedCell = new VerticallyMergedCell();

                    if (first)
                    {
                        cell.VerticallyMergedCell.Type = MergeCellType.Restart;
                    }

                    break;

                default:
                    cell.Width = new Width(TableWidthUnit.Point, 2000);
                    if (first)
                    {
                        if (i > 0)
                        {
                            cell.TopBorder         = InvisibleBorders.Top;
                            cell.LeftBorder        = new LeftBorder(StandardBorderStyle.None);
                            cell.RightBorder       = new RightBorder(StandardBorderStyle.None);
                            cell.VerticalAlignment = VerticalAlignmentType.Center;
                            if (i == 1)
                            {
                                cell.HorizontallyMergedCell = new HorizontallyMergedCell
                                {
                                    Type = MergeCellType.Restart
                                };
                                cell.Content.Add(
                                    WordFactory.Paragraph(
                                        WordFactory.Text("Objective Result: ______________")).Center());
                            }
                            else
                            {
                                cell.HorizontallyMergedCell = new HorizontallyMergedCell
                                {
                                    Type = MergeCellType.Continue
                                };
                            }
                        }
                        else
                        {
                            cell.TopBorder   = InvisibleBorders.Top;
                            cell.RightBorder = new RightBorder(StandardBorderStyle.None);
                        }
                        source.Height = new RowHeight(HeightRule.Exact, 1100);
                    }
                    if (second)
                    {
                        if (i > 0)
                        {
                            cell.Content.Add(new Paragraph()
                                             .WithRuns(
                                                 new Run().Stylize("Trial " + i.ToString(), 20, Defaults.FontFamily))
                                             .SetHorizontalAlignment(HorizontalAlignmentType.Center)
                                             .SetVerticalAlignment(VerticalTextAlignment.Center)
                                             .SetSpacing(4, 0));
                            cell.Shading           = new Shading(ShadingPattern.Percent20);
                            cell.VerticalAlignment = VerticalAlignmentType.Center;
                        }
                        source.Height = new RowHeight(HeightRule.Exact, 300);
                    }
                    if (third)
                    {
                        if (i > 0)
                        {
                            cell.Content.Add(new Paragraph().WithRuns(new Run().Stylize("Y", 20, Defaults.FontFamily))
                                             .SetHorizontalAlignment(HorizontalAlignmentType.Center)
                                             .SetVerticalAlignment(VerticalTextAlignment.Bottom));
                            //    .SetHorizontalAlignment(HorizontalAlignmentType.Center));
                            cell.BottomBorder       = new BottomBorder(StandardBorderStyle.None);
                            cell.VerticalAlignment  = VerticalAlignmentType.Center;
                            cell.TopMarginException = new Width(TableWidthUnit.Point, 50);
                        }
                        source.Height = new RowHeight(HeightRule.Exact, 500);
                    }
                    if (fourth)
                    {
                        if (i > 0)
                        {
                            cell.Content.Add(new Paragraph().WithRuns(new Run().Stylize("N", 20, Defaults.FontFamily))
                                             .SetHorizontalAlignment(HorizontalAlignmentType.Center)
                                             .SetVerticalAlignment(VerticalTextAlignment.Center));
                            cell.TopBorder          = InvisibleBorders.Top;
                            cell.VerticalAlignment  = VerticalAlignmentType.Center;
                            cell.TopMarginException = new Width(TableWidthUnit.Point, 50);
                        }
                        source.Height = new RowHeight(HeightRule.Exact, 500);
                    }
                    break;
                }
            }

            return(source);
        }
예제 #3
0
        public static WordDocument AddStudentInfo(this WordDocument source, string name, string id, string dob, GenderType gender, string grade, string campus, SchoolYearType schoolYear, string teacherName, string gradingPeriod)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (dob == null)
            {
                throw new ArgumentNullException(nameof(dob));
            }

            if (grade == null)
            {
                throw new ArgumentNullException(nameof(grade));
            }

            if (campus == null)
            {
                throw new ArgumentNullException(nameof(campus));
            }

            if (teacherName == null)
            {
                throw new ArgumentNullException(nameof(teacherName));
            }

            if (gradingPeriod == null)
            {
                throw new ArgumentNullException(nameof(gradingPeriod));
            }

            DateTime zeroTime = new DateTime(1, 1, 1);
            var      age      = DateTime.Now - DateTime.Parse(dob);
            int      years    = (zeroTime + age).Year - 1;

            string school_year;

            switch (schoolYear)
            {
            case SchoolYearType._2019_2020:
                school_year = "2019-2020";
                break;

            default:
                school_year = "2020-2021";
                break;
            }

            return(source.AddParagraph(WordFactory.Paragraph(
                                           HorizontalAlignmentType.Left,
                                           WordFactory.Text("Name: "),
                                           WordFactory.UnderlineText(name).AppendTab(),
                                           WordFactory.Text("\t DOB: "),
                                           WordFactory.UnderlineText(dob).AppendTab(),
                                           WordFactory.Text("\t ID#: "),
                                           WordFactory.UnderlineText(id).AppendTab(),
                                           WordFactory.Text("\t Age: "),
                                           WordFactory.UnderlineText(years.ToString()).AppendTab(),
                                           WordFactory.Text("\t Gender: "),
                                           WordFactory.UnderlineText(gender.ToString()).AppendTab(),
                                           WordFactory.Text("\t Grade: "),
                                           WordFactory.UnderlineText(grade).AppendTab().AppendCarriageReturn().AppendCarriageReturn(),
                                           WordFactory.Text("School Year: "),
                                           WordFactory.UnderlineText(school_year).AppendTab(),
                                           WordFactory.Text("\t Campus: "),
                                           WordFactory.UnderlineText(campus).AppendTab(),
                                           WordFactory.Text("\t Reviewer: "),
                                           WordFactory.UnderlineText(teacherName).AppendTab().AppendCarriageReturn().AppendCarriageReturn(),
                                           WordFactory.Text("Grading Period: "),
                                           WordFactory.UnderlineText(gradingPeriod).AppendTab(),
                                           WordFactory.Text("\t Documentation Date: "),
                                           WordFactory.UnderlineText("                   ").AppendTab(),
                                           WordFactory.Text("\t Goal Result: "),
                                           WordFactory.UnderlineText("                   ").AppendTab().AppendCarriageReturn()
                                           )));
        }