示例#1
0
文件: Form1.cs 项目: jack06215/tmc
        private Word.Table RequirementToWordTable(Requirement rqmnt, Word.Range location, Word.Document doc)
        {
            Word.Range tblRange = doc.Bookmarks[EndOfDoc].Range;
            Word.Table table = doc.Tables.Add(tblRange, 8, 2);

            table.Borders.Enable = 1;

            table.Cell(1, 1).Range.Text = "Identifier";
            table.Cell(1, 2).Range.Text = rqmnt.Id;
            table.Cell(2, 1).Range.Text = "Statement";
            table.Cell(2, 2).Range.Text = rqmnt.Description;
            table.Cell(3, 1).Range.Text = "Date Created";
            table.Cell(3, 2).Range.Text = rqmnt.DateCreated;
            table.Cell(4, 1).Range.Text = "Change History";
            table.Cell(4, 2).Range.Text = rqmnt.ChangeHistory;
            table.Cell(5, 1).Range.Text = "Dependencies";
            table.Cell(5, 2).Range.Text = rqmnt.Dependencies;
            table.Cell(6, 1).Range.Text = "Sources";
            table.Cell(6, 2).Range.Text = rqmnt.Traceability;
            table.Cell(7, 1).Range.Text = "Rationale";
            table.Cell(7, 2).Range.Text = rqmnt.Rationale;
            table.Cell(8, 1).Range.Text = "Classification";
            table.Cell(8, 2).Range.Text = rqmnt.Classification;

            table.PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPercent;
            table.PreferredWidth = 100;

            table.Columns[1].PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPercent;
            table.Columns[1].PreferredWidth = 15;

            for (int i = 1; i < 9; i++)
            {
                table.Cell(i, 1).Range.Font.Bold = 1;
            }

            return table;
        }
示例#2
0
文件: Form1.cs 项目: jack06215/tmc
        private Requirement ExcelRowToRequirement(Excel.Range excelRow)
        {
            var r = new Requirement();

            r.Id = excelRow.Cells[Missing, "A"].Value as string;
            r.Description = excelRow.Cells[Missing, "B"].Value as string;
            r.Function = excelRow.Cells[Missing, "C"].Value as string;
            r.Type = excelRow.Cells[Missing, "D"].Value as string;
            r.Classification = excelRow.Cells[Missing, "E"].Value as string;
            r.Rationale = excelRow.Cells[Missing, "F"].Value as string;
            r.Dependencies = excelRow.Cells[Missing, "G"].Value as string;
            r.DateCreated = excelRow.Cells[Missing, "H"].Value as string;
            r.ChangeHistory = excelRow.Cells[Missing, "I"].Value as string;
            r.Traceability = excelRow.Cells[Missing, "J"].Value as string;

            return r;
        }