コード例 #1
0
        public override void FillContent()
        {
            SetPlaceholder(NewSlidePart, "{title}", _forces.DiagramName);

            Table tbl = NewSlidePart.Slide.Descendants <Table>().First();

            TableGrid tableGrid = tbl.TableGrid;

            for (int i = 0; i != _forces.GetDecisions().Length; i++)
            {
                var gc = new GridColumn {
                    Width = 1234000L
                };
                tableGrid.AppendChild(gc);
            }

            // insert the concern header and the decisions names
            TableRow decRow = tbl.Descendants <TableRow>().First();

            foreach (
                TableCell decCell in
                _forces.GetDecisions()
                .Select(decision => CreateTextCell(decision.Name)))
            {
                decRow.AppendChild(decCell);
            }

            foreach (var concernsPerForce in _forces.GetConcernsPerForce())
            {
                IEAElement        force    = concernsPerForce.Key;
                List <IEAElement> concerns = concernsPerForce.Value;

                foreach (IEAElement concern in concerns)
                {
                    var forceRow = new TableRow {
                        Height = 370840L
                    };
                    forceRow.AppendChild(CreateTextCell(force.Name));
                    forceRow.AppendChild(CreateTextCell(concern.Name));

                    // insert ratings
                    foreach (Rating rating in _forces.GetRatings())
                    {
                        if (rating.ForceGUID != force.GUID || rating.ConcernGUID != concern.GUID)
                        {
                            continue;
                        }
                        if (_forces.GetDecisions().Any(decision => rating.DecisionGUID == decision.GUID))
                        {
                            forceRow.AppendChild(CreateTextCell(rating.Value));
                        }
                    }
                    tbl.AppendChild(forceRow);
                }
            }
        }
コード例 #2
0
        public void InsertForcesTable(IForcesModel forces)
        {
            WorksheetPart worksheetPart            = InsertWorksheet(forces.Name);
            const string  forcesTableTopLeftColumn = "A";
            const uint    forcesTopLeftRow         = 1;

            InsertText(worksheetPart, forcesTableTopLeftColumn, forcesTopLeftRow, "Force");
            InsertText(worksheetPart, forcesTopLeftRow, "Concern");

            foreach (IEAElement decision in forces.GetDecisions())
            {
                InsertText(worksheetPart, forcesTopLeftRow, decision.Name);
            }

            uint rowIndex = forcesTopLeftRow + 1;

            foreach (var concernsPerForce in forces.GetConcernsPerForce())
            {
                IEAElement        force    = concernsPerForce.Key;
                List <IEAElement> concerns = concernsPerForce.Value;

                foreach (IEAElement concern in concerns)
                {
                    InsertText(worksheetPart, forcesTableTopLeftColumn, rowIndex, force.Name);
                    InsertText(worksheetPart, rowIndex, concern.Name);
                    foreach (Rating rating in forces.GetRatings())
                    {
                        if (rating.ForceGUID != force.GUID || rating.ConcernGUID != concern.GUID)
                        {
                            continue;
                        }
                        if (forces.GetDecisions().Any(decision => rating.DecisionGUID == decision.GUID))
                        {
                            InsertText(worksheetPart, rowIndex, rating.Value);
                        }
                    }
                    rowIndex++;
                }
            }


            worksheetPart.Worksheet.Save();
        }
コード例 #3
0
        private void InsertForcesAndConcerns(IForcesModel model, DataTable table)
        {
            int rowIndex = 0;

            foreach (var dictionary in model.GetConcernsPerForce())
            {
                IEAElement        force    = dictionary.Key;
                List <IEAElement> concerns = dictionary.Value;

                foreach (IEAElement concern in concerns)
                {
                    //in first column add force and concern guid
                    var     forceConcernGuid = new object[] { force.GUID };
                    DataRow row = table.Rows.Add(forceConcernGuid);
                    _forcesTable.DataSource = table;
                    _forcesTable.Rows[rowIndex++].HeaderCell.Value = force.Name;

                    row[ForcesTableContext.ConcernColumnIndex]     = concern.Name;
                    row[ForcesTableContext.ConcernGUIDColumnIndex] = concern.GUID;
                }
            }
        }
コード例 #4
0
        public void InsertForcesTable(IForcesModel forces)
        {
            Paragraph     para          = _body.AppendChild(new Paragraph());
            Run           run           = para.AppendChild(new Run());
            RunProperties runProperties = getHeading2(run);

            run.AppendChild(new Text(++_diagmarCounter + ". Decision Forces Viewpoint: " + forces.Name));
            //_body.AppendChild(new Paragraph(new Run(new Text(++_diagmarCounter + ". Decision Forces Viewpoint"))));
            _body.AppendChild(new Paragraph(new Run(new Text())));

            var table = new Table();

            var props = new TableProperties(
                new TableBorders(
                    new TopBorder
            {
                Val  = new EnumValue <BorderValues>(BorderValues.Single),
                Size = 11
            },
                    new BottomBorder
            {
                Val  = new EnumValue <BorderValues>(BorderValues.Single),
                Size = 11
            },
                    new LeftBorder
            {
                Val  = new EnumValue <BorderValues>(BorderValues.Single),
                Size = 11
            },
                    new RightBorder
            {
                Val  = new EnumValue <BorderValues>(BorderValues.Single),
                Size = 11
            },
                    new InsideHorizontalBorder
            {
                Val  = new EnumValue <BorderValues>(BorderValues.Single),
                Size = 11
            },
                    new InsideVerticalBorder
            {
                Val  = new EnumValue <BorderValues>(BorderValues.Single),
                Size = 11
            }));

            table.AppendChild(props);

            var emptyCell = new TableCell();

            // insert an empty cell in tol left of forces table
            var decRow = new TableRow();

            decRow.AppendChild(emptyCell);
            emptyCell.AppendChild(new Paragraph(new Run(new Text(""))));

            // insert the concern header and the decisions names
            var concCellHeader = new TableCell(new Paragraph(new Run(new Text("Concerns"))));

            decRow.AppendChild(concCellHeader);
            foreach (
                TableCell decCell in
                forces.GetDecisions()
                .Select(decision => new TableCell(new Paragraph(new Run(new Text(decision.Name))))))
            {
                decRow.AppendChild(decCell);
            }
            table.AppendChild(decRow);


            foreach (var concernsPerForces in forces.GetConcernsPerForce())
            {
                IEAElement        force    = concernsPerForces.Key;
                List <IEAElement> concerns = concernsPerForces.Value;

                foreach (IEAElement concern in concerns)
                {
                    var forceRow  = new TableRow();
                    var forceCell = new TableCell(new Paragraph(new Run(new Text(force.Name))));
                    forceRow.AppendChild(forceCell);
                    var concCell = new TableCell();
                    concCell.AppendChild(new Paragraph(new Run(new Text(concern.Name))));
                    forceRow.AppendChild(concCell);

                    // insert ratings
                    foreach (Rating rating in forces.GetRatings())
                    {
                        if (rating.ForceGUID != force.GUID || rating.ConcernGUID != concern.GUID)
                        {
                            continue;
                        }
                        if (forces.GetDecisions().Any(decision => rating.DecisionGUID == decision.GUID))
                        {
                            var ratCell = new TableCell();
                            ratCell.AppendChild(new Paragraph(new Run(new Text(rating.Value))));
                            forceRow.AppendChild(ratCell);
                        }
                    }
                    table.AppendChild(forceRow);
                }
            }


            _body.AppendChild(table);
            _body.AppendChild(new Paragraph());
        }