public static InsertBeforeOrAfter ChangesetsSection(this InsertBeforeOrAfter lastPart, List <KeyValuePair <string, List <ChangesetInfo> > > categorizedChangesets)
        {
            var heading    = "Code Change sets in this Release";
            var subHeading = "The following list of code check-ins to TFS was compiled to make up this release";
            var paragraph  = lastPart.CreateSectionWithParagraph(heading, subHeading);
            InsertBeforeOrAfter newLastPart = paragraph;

            foreach (var category in categorizedChangesets.Where(x => x.Value.Count > 0))
            {
                var headers     = new[] { "TFS", "Developer", "Date/Time", "Description" };
                var columnSizes = new[] { 10f, 25, 30f, 35f };
                var p           = newLastPart.InsertParagraphAfterSelf(category.Key).FontSize(11d).Heading(HeadingType.Heading2);
                var table       = p.CreateTableWithHeader(headers, columnSizes, category.Value.Count + 1);

                for (var i = 0; i < category.Value.Count; i++)
                {
                    var item    = category.Value[i];
                    var rowData = new[] { item.Id.ToString(), item.CommitedBy, item.Created.ToString(), item.Comment };
                    table.FillRow(i + 1, rowData);
                }

                newLastPart = table;
            }

            return(newLastPart);
        }
예제 #2
0
        private Table ThirdSection(IEnumerable <ClientWorkItem> workItems, InsertBeforeOrAfter lastPart)
        {
            var paragraph = CreateSectionWithParagraph(lastPart, "Product reported Defects in this Release",
                                                       "This section gives a list of Client-facing defects that were fixed in this release");
            var table = paragraph.InsertTableAfterSelf(2, 3);

            table.SetWidthsPercentage(new[] { 10f, 75f, 15f }, null);
            table.AutoFit = AutoFit.ColumnWidth;
            table.GetCell(0, 0).FillFirstParagraph("Bug Id").Bold();
            table.GetCell(0, 1).FillFirstParagraph("Work Item Description").Bold();
            table.GetCell(0, 2).FillFirstParagraph("Client Project").Bold();

            var placeholderRow = table.Rows[1];

            table.GetCell(1, 0).FillFirstParagraph("{TfsID}");
            table.GetCell(1, 1).FillFirstParagraph("{WorkItemTitle}");
            table.GetCell(1, 2).FillFirstParagraph("{Client}");

            foreach (var item in workItems)
            {
                var newItem = table.InsertRow(placeholderRow, table.RowCount - 1);

                newItem.ReplaceText("{TfsID}", item.Id.ToString());
                newItem.ReplaceText("{WorkItemTitle}", item.Title);
                newItem.ReplaceText("{Client}", item.ClientProject);
            }

            placeholderRow.Remove();
            return(table);
        }
예제 #3
0
        private Paragraph CreateSectionWithParagraph(InsertBeforeOrAfter lastPart, string headingTitle, string paragraphText)
        {
            var heading   = lastPart.CreateHeadingSection(headingTitle);
            var paragraph = heading.InsertParagraphAfterSelf(paragraphText).FontSize(10d);

            return(paragraph);
        }
        public static Table KnownIssuesSection(this InsertBeforeOrAfter lastPart)
        {
            var headers     = new[] { "Bug Id", "Work Item Description" };
            var columnSizes = new[] { 25f, 75f };
            var heading     = "Known issues in this Release";
            var subHeading  = "This section gives a list of bugs that were identified throughout testing of this release";
            var paragraph   = lastPart.CreateSectionWithParagraph(heading, subHeading);

            return(paragraph.CreateTableWithHeader(headers, columnSizes, 2));
        }
        public static Table CreateTableWithHeader(this InsertBeforeOrAfter lastPart, string[] headers,
                                                  float[] columnSizes, int rows)
        {
            rows = rows >= 1 ? rows : 1;
            var table = lastPart.InsertTableAfterSelf(rows, headers.Length);

            table.SetWidthsPercentage(columnSizes, null);
            table.AutoFit = AutoFit.ColumnWidth;
            table.FillRow(0, headers, true);
            return(table);
        }
예제 #6
0
        private void AddTextblockParagraph(string placeholder, string substitutionText)
        {
            var placeholderParagraph = FindPlaceholderParagraph(_document, placeholder);

            if (placeholderParagraph == null)
            {
                throw new InstanceExportException($"The provided template lacks a placeholder '{GetFullPlaceholderText(placeholder)}'.");
            }

            var newParagraph = _activeInsertBeforeOrAfter.InsertParagraphAfterSelf(placeholderParagraph);

            Substitute(newParagraph, placeholder, substitutionText);

            _activeInsertBeforeOrAfter = newParagraph;
        }
예제 #7
0
        private InsertBeforeOrAfter SecondSection(Dictionary <string, List <ChangesetInfo> > categorizedChangesets, InsertBeforeOrAfter lastPart)
        {
            var paragraph = CreateSectionWithParagraph(lastPart, "Code Change sets in this Release",
                                                       "The following list of code check-ins to TFS was compiled to make up this release");
            InsertBeforeOrAfter newLastPart = paragraph;

            foreach (var category in categorizedChangesets)
            {
                var p = newLastPart.InsertParagraphAfterSelf(category.Key).FontSize(11d).Heading(HeadingType.Heading2);

                var table = p.InsertTableAfterSelf(2, 6);
                table.SetWidthsPercentage(new[] { 10f, 15f, 15f, 20f, 10f, 30f }, null);
                table.GetCell(0, 0).FillFirstParagraph("TFS").Bold();
                table.GetCell(0, 1).FillFirstParagraph("Developer").Bold();
                table.GetCell(0, 2).FillFirstParagraph("Date/Time").Bold();
                table.GetCell(0, 3).FillFirstParagraph("Description").Bold();
                table.GetCell(0, 4).FillFirstParagraph("Work Item").Bold();
                table.GetCell(0, 5).FillFirstParagraph("Work Item Description").Bold();

                var rowPattern = table.Rows[1];
                table.GetCell(1, 0).FillFirstParagraph("{TfsID}");
                table.GetCell(1, 1).FillFirstParagraph("{Dev}");
                table.GetCell(1, 2).FillFirstParagraph("{Date}");
                table.GetCell(1, 3).FillFirstParagraph("{Desc}");
                table.GetCell(1, 4).FillFirstParagraph("{WorkItemId}");
                table.GetCell(1, 5).FillFirstParagraph("{WorkItemTitle}");

                foreach (var change in category.Value)
                {
                    var newItem = table.InsertRow(rowPattern, table.RowCount - 1);

                    newItem.ReplaceText("{TfsID}", change.Id.ToString());
                    newItem.ReplaceText("{Dev}", change.CommitedBy);
                    newItem.ReplaceText("{Date}", change.Created.ToString());
                    newItem.ReplaceText("{Desc}", change.Comment);
                    newItem.ReplaceText("{WorkItemId}", change.WorkItemId);
                    newItem.ReplaceText("{WorkItemTitle}", change.WorkItemTitle);
                }

                rowPattern.Remove();
                table.AutoFit = AutoFit.ColumnWidth;
                newLastPart   = table;
            }

            return(newLastPart);
        }
        public static Table PbiSection(this InsertBeforeOrAfter lastPart, IEnumerable <ClientWorkItem> pbi)
        {
            var pbiList = pbi.ToList();

            var headers     = new[] { "Bug Id", "Work Item Description" };
            var columnSizes = new[] { 25f, 75f };
            var heading     = "Product Backlog Items in this Release";
            var subHeading  = "This section gives a list of PBIs that were delivered in this release";
            var paragraph   = lastPart.CreateSectionWithParagraph(heading, subHeading);
            var table       = paragraph.CreateTableWithHeader(headers, columnSizes, pbiList.Count + 1);

            for (var i = 0; i < pbiList.Count; i++)
            {
                var item    = pbiList[i];
                var rowData = new[] { item.Id.ToString(), item.Title };
                table.FillRow(i + 1, rowData);
            }
            return(table);
        }
예제 #9
0
        public override void WriteBeginPresentationNetwork(PresentationNetwork presentationNetwork)
        {
            var placeholderParagraph = FindPlaceholderParagraph(_document, Placeholders.Network);

            if (placeholderParagraph == null)
            {
                throw new InstanceExportException($"The provided template lacks a placeholder for the presentation network. Add a placeholder that looks like this: '{GetFullPlaceholderText(Placeholders.Network)}'.");
            }

            if (_activeInsertBeforeOrAfter == null)
            {
                _activeInsertBeforeOrAfter = placeholderParagraph;
            }

            var newParagraph = _activeInsertBeforeOrAfter.InsertParagraphAfterSelf(placeholderParagraph);

            Substitute(newParagraph, Placeholders.Network, presentationNetwork.Name);

            _activeInsertBeforeOrAfter = newParagraph;
        }
        public static Table WorkItemSection(this InsertBeforeOrAfter lastPart, IEnumerable <ClientWorkItem> workItems)
        {
            var workItemList = workItems.ToList();

            var headers     = new[] { "Bug Id", "Work Item Description", "Client Project" };
            var columnSizes = new[] { 10f, 75f, 15f };
            var heading     = "Product reported Defects in this Release";
            var subHeading  = "This section gives a list of Client-facing defects that were fixed in this release";
            var paragraph   = lastPart.CreateSectionWithParagraph(heading, subHeading);
            var table       = paragraph.CreateTableWithHeader(headers, columnSizes, workItemList.Count + 1);

            for (var i = 0; i < workItemList.Count; i++)
            {
                var item    = workItemList[i];
                var rowData = new[] { item.Id.ToString(), item.Title, item.ClientProject };
                table.FillRow(i + 1, rowData);
            }

            return(table);
        }
예제 #11
0
        private Table AddTable(DocXBasedTableContext tableContext)
        {
            if (_activeInsertBeforeOrAfter is Table)
            {
                _activeInsertBeforeOrAfter = _activeInsertBeforeOrAfter.InsertParagraphAfterSelf(string.Empty);
            }

            var table = _activeInsertBeforeOrAfter.InsertTableAfterSelf(_templateTable);

            _activeInsertBeforeOrAfter = table;

            while (table.RowCount > 1)
            {
                table.RemoveRow();
            }
            while (table.ColumnCount > 1)
            {
                table.RemoveColumn();
            }

            var headerRow = table.Rows.First();

            foreach (var member in tableContext.LinearisedHorizontalAxis)
            {
                table.InsertColumn();

                var itemMember  = member as ItemMember;
                var placeholder = itemMember != null?string.Format(Placeholders.CellMemberLevel, itemMember.Depth) : Placeholders.CellMember;

                var cell = headerRow.Cells.Last();
                cell.VerticalAlignment = VerticalAlignment.Bottom; // Hardcoded. We could read it from the template if we wanted.
                AddCellParagraph(cell, placeholder, GetMemberText(member));
            }

            return(table);
        }
예제 #12
0
 public static Paragraph CreateHeadingSection(this InsertBeforeOrAfter paragraph, string title)
 {
     return(paragraph.InsertParagraphAfterSelf(title)
            .Heading(HeadingType.Heading1));
 }
 public static Paragraph CreateSectionWithParagraph(this InsertBeforeOrAfter lastPart, string headingTitle, string paragraphText)
 {
     return(lastPart.CreateHeadingSection(headingTitle).InsertParagraphAfterSelf(paragraphText).FontSize(10d));
 }