示例#1
0
 public static WordDocument AddTitle(this WordDocument source, string title)
 {
     source.Body.Add(
         WordFactory.Paragraph(WordFactory.BoldText(title, Defaults.FontSize + 4, Defaults.FontFamily))
         .SetHorizontalAlignment(HorizontalAlignmentType.Center));
     return(source);
 }
        public static WordDocument CreateDocument(Student student, AnnualGoal goal, string teacherName, string gradingPeriod, SchoolYearType year, string campus)
        {
            WordDocument doc = WordFactory.Document();

            doc = doc.AddTitle("Special Education");
            doc = doc.AddTitle("Data Collection Sheet");
            doc = doc.AddStudentInfo(student.GetFullName(), student.LocalID, student.DateOfBirth, student.Gender, student.Grade, campus, year, teacherName, gradingPeriod);
            doc = doc.AddGoal(goal);
            return(doc);
        }
示例#3
0
        public static WordDocument AppendPageBreak(this WordDocument source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            source.Body.Add(WordFactory.Paragraph(WordFactory.PageBreak()));
            return(source);
        }
示例#4
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);
        }
示例#5
0
        public static WordDocument AddGoal(this WordDocument source, AnnualGoal goal, bool singleDocument = false, bool last = false)
        {
            //Paragraph p1 = new Paragraph();
            //Paragraph p2 = new Paragraph();
            //Run number = new Run().Stylize(goal.Code, Defaults.FontSize, Defaults.FontFamily, false, true, true);
            //Run colon = new Run().Stylize(":", Defaults.FontSize, Defaults.FontFamily, false, true, false);
            //Run focus = new Run().Stylize(goal.Focus.ToString(), Defaults.FontSize, Defaults.FontFamily, false, true, true);
            //Run annualGoalLabel = new Run().Stylize("ANNUAL GOAL: ", Defaults.FontSize, Defaults.FontFamily, false, true, false);
            //Run annualGoal = new Run().Stylize(goal.ToStatement(), Defaults.FontSize, Defaults.FontFamily, italics: true, bold: true, underline: false);
            //p1.Add(number);
            //p1.Add(colon);
            //p1.Add(focus);
            //p2.Add(annualGoalLabel);
            //p2.Add(annualGoal);
            //source.Body.Add(p1);
            //source.Body.Add(p2);

            source = source.AddParagraph(
                WordFactory.Paragraph(
                    WordFactory.BoldText(goal.Code + ":"),
                    WordFactory.BoldUnderlineText(goal.GetFocus())),
                WordFactory.Paragraph(
                    WordFactory.BoldText("ANNUAL GOAL: "),
                    WordFactory.BoldItalicText(goal.ToStatement())));



            foreach (var objective in goal.Objectives.Objective)
            {
                source = source.AddObjective(objective);
            }

            if (singleDocument)
            {
                if (!last)
                {
                    source = source.AppendPageBreak();
                }
            }


            return(source);
        }
        private static void CreateSingleDocument(string targetDirectory, string evaluator, int period, SchoolYear schoolYear)
        {
            var doc           = WordFactory.Document();
            var gradingPeriod = $"Grading Period {period}";

            foreach (var student in schoolYear.Students.Student)
            {
                var lastNumber = student.AnnualGoals.Goals.Count - 1;
                for (var i = 0; i < student.AnnualGoals.Goals.Count; i++)
                {
                    var goal = student.AnnualGoals.Goals[i];
                    doc = doc.ProcessDocument(student, goal, evaluator, gradingPeriod, schoolYear.Identifier, student.Campus, false);
                }
            }


            var fileName = $"2020–2021_oms_ale_marshall_gp{period}_goals_objectives_data_sheet.docx";
            var newPath  = Path.Combine(targetDirectory, fileName);

            doc.Save(newPath, true);
        }
示例#7
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);
        }
示例#8
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()
                                           )));
        }