private List<customSection> getCriteria32Grid(DataTable dt) { //Set up TableProperties TableProperties tableProperties1 = new TableProperties(); TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" }; TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto }; TableIndentation tableIndentation1 = new TableIndentation() { Width = 0, Type = TableWidthUnitValues.Dxa }; TableLook tableLook1 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }; tableProperties1.Append(tableStyle1); tableProperties1.Append(tableWidth1); tableProperties1.Append(tableIndentation1); tableProperties1.Append(tableLook1); //Species header (need as separate grid b/c only one column) TableGrid gridHeader = new TableGrid(); gridHeader.Append(new GridColumn() { Width = "8725" }); //Body TableGrid gridBody = new TableGrid(); gridBody.Append(new GridColumn() { Width = "3325" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); //Title bar TableRow header = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; header.Append(getCell("Region / Method", clrBlueMid, "3325", clrBlueText, true)); header.Append(getCell("Strategy", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Research", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Advice", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Enforce", clrBlueMid, "1350", clrBlueText, true)); Table tableHeader = new Table(); Table tableBody = new Table(); List<customSection> tables = new List<customSection>(); //add 3.2 Header tableHeader = new Table(); TableGrid tmpGrid = (TableGrid)gridHeader.Clone(); TableRow headerRow = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; headerRow.Append(getCell("Factor 3.2: Management of fishing impacts on bycatch species", clrHeading, "8725", clrBlueText, true)); tmpGrid.Append(headerRow); tableHeader.Append(tableProperties1.CloneNode(true)); tableHeader.Append(tmpGrid); tables.Add(new customSection(tableHeader)); //Add column headers tableBody = new Table(); tableBody.Append(tableProperties1.CloneNode(true)); tableBody.Append(gridBody.CloneNode(true)); tableBody.Append(header.CloneNode(true)); //string commonName = ""; foreach (DataRow dr in dt.Rows) { TableRow row = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; string col = dr["Location"].ToString() + " " + dr["BodyOfWater"].ToString() + "\r\n" + dr["Method"].ToString(); row.Append(getCell(col, clrBlueLt, "1000", clrGreyText, true)); string col2 = dr["Factor2ScoreDescription"].ToString(); row.Append(getCell(col2, "FFFFFF", "1000")); string col3 = dr["Factor3ScoreDescription"].ToString(); row.Append(getCell(col3, "FFFFFF", "1000")); string col4 = dr["Factor4ScoreDescription"].ToString(); row.Append(getCell(col4, "FFFFFF", "1000")); string col5 = dr["Factor5ScoreDescription"].ToString(); row.Append(getCell(col5, "FFFFFF", "1000")); tableBody.Append(row); } tables.Add(new customSection(tableBody)); //store last table return tables; }
private List<customSection> getCriteria1Grids(DataTable dt) { //Set up TableProperties TableProperties tableProperties1 = new TableProperties(); TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" }; TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto }; TableIndentation tableIndentation1 = new TableIndentation() { Width = 0, Type = TableWidthUnitValues.Dxa }; TableLook tableLook1 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }; tableProperties1.Append(tableStyle1); tableProperties1.Append(tableWidth1); tableProperties1.Append(tableIndentation1); tableProperties1.Append(tableLook1); //Species header (need as separate grid b/c only one column) TableGrid gridHeader = new TableGrid(); gridHeader.Append(new GridColumn() { Width = "8725" }); //Body TableGrid gridBody = new TableGrid(); gridBody.Append(new GridColumn() { Width = "3325" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); //Title bar TableRow header = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; header.Append(getCell("Region / Method", clrBlueMid, "3325", clrBlueText, true)); header.Append(getCell("Inherent \r\nVulnerability", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Stock Status", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Fishing Mortality", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Subscore", clrBlueMid, "1890", clrBlueText, true)); Table tableHeader = new Table(); Table tableBody = new Table(); List<customSection> tables = new List<customSection>(); string commonName = ""; foreach (DataRow dr in dt.Rows) { //Run once per species if (commonName != dr["CommonName"].ToString()) { //Store what you've already done (skip first pass), and reset variable if (commonName != "") tables.Add(new customSection(tableBody)); commonName = dr["CommonName"].ToString(); //add Species Header tableHeader = new Table(); TableGrid tmpGrid = (TableGrid)gridHeader.Clone(); TableRow headerRow = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; headerRow.Append(getCell(commonName, clrHeading, "8725", clrBlueText, true)); tmpGrid.Append(headerRow); tableHeader.Append(tableProperties1.CloneNode(true)); tableHeader.Append(tmpGrid); tables.Add(new customSection(tableHeader)); //Add "Region/Method" header tableBody = new Table(); tableBody.Append(tableProperties1.CloneNode(true)); tableBody.Append(gridBody.CloneNode(true)); tableBody.Append(header.CloneNode(true)); } TableRow row = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; string col = dr["Location"].ToString() + " " + dr["BodyOfWater"].ToString() + "\r\n" + dr["Method"].ToString(); row.Append(getCell(col, clrBlueLt, "1000", clrGreyText, true)); string col1 = dr["Factor1Score"].ToString() + ":" + dr["Factor1ScoreDescription"].ToString(); row.Append(getCell(col1, "FFFFFF", "1000")); string col2 = dr["Factor2Score"].ToString() + ":" + dr["Factor2ScoreDescription"].ToString(); row.Append(getCell(col2, "FFFFFF", "1000")); string col3 = dr["Factor3Score"].ToString() + ":" + dr["Factor3ScoreDescription"].ToString(); row.Append(getCell(col3, "FFFFFF", "1000")); string col5 = dr["Color"].ToString() + " (" + dr["Score"].ToString() + ")"; row.Append(getCell(col5, getColor(dr["Color"].ToString()), "1000", true)); tableBody.Append(row); } tables.Add(new customSection(tableBody)); //store last table return tables; }
private List<customSection> getCriteria2Grids(DataTable dt) { //Set up TableProperties TableProperties tableProperties1 = new TableProperties(); TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" }; TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto }; TableIndentation tableIndentation1 = new TableIndentation() { Width = 0, Type = TableWidthUnitValues.Dxa }; TableLook tableLook1 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }; tableProperties1.Append(tableStyle1); tableProperties1.Append(tableWidth1); tableProperties1.Append(tableIndentation1); tableProperties1.Append(tableLook1); //Species header (need as separate grid b/c only one column) TableGrid gridHeader = new TableGrid(); gridHeader.Append(new GridColumn() { Width = "8725" }); //Body TableGrid gridBody = new TableGrid(); gridBody.Append(new GridColumn() { Width = "3325" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); //Title bar TableRow header = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; header.Append(getCell("Species", clrBlueMid, "3325", clrBlueText, true)); header.Append(getCell("Inherent \r\nVulnerability", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Stock Status", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Fishing Mortality", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Subscore", clrBlueMid, "1890", clrBlueText, true)); Table tableHeader = new Table(); Table tableBody = new Table(); List<customSection> tables = new List<customSection>(); string commonName = ""; foreach (DataRow dr in dt.Rows) { //Run once per species if (commonName != dr["LocationMethod"].ToString()) { //Store what you've already done (skip first pass), and reset variable if (commonName != "") tables.Add(new customSection(tableBody)); commonName = dr["LocationMethod"].ToString(); //add Species Header tableHeader = new Table(); TableGrid tmpGrid = (TableGrid)gridHeader.Clone(); TableRow headerRow = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; headerRow.Append(getCell(commonName, clrHeading, "8725", clrBlueText, true)); //add Scoring Header #region Scoring Header TableRow headerRow2 = new TableRow(@"<w:tr w:rsidR=""00B702EB"" w:rsidTr=""00284F47"" xmlns:w=""http://schemas.openxmlformats.org/wordprocessingml/2006/main""> <w:trPr> <w:cnfStyle w:val=""000000100000"" w:firstRow=""0"" w:lastRow=""0"" w:firstColumn=""0"" w:lastColumn=""0"" w:oddVBand=""0"" w:evenVBand=""0"" w:oddHBand=""1"" w:evenHBand=""0"" w:firstRowFirstColumn=""0"" w:firstRowLastColumn=""0"" w:lastRowFirstColumn=""0"" w:lastRowLastColumn=""0"" /> <w:trHeight w:val=""297"" /> </w:trPr> <w:tc> <w:tcPr> <w:cnfStyle w:val=""001000000000"" w:firstRow=""0"" w:lastRow=""0"" w:firstColumn=""1"" w:lastColumn=""0"" w:oddVBand=""0"" w:evenVBand=""0"" w:oddHBand=""0"" w:evenHBand=""0"" w:firstRowFirstColumn=""0"" w:firstRowLastColumn=""0"" w:lastRowFirstColumn=""0"" w:lastRowLastColumn=""0"" /> <w:tcW w:w=""9576"" w:type=""dxa"" /> <w:tcBorders> <w:top w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:left w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:bottom w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:right w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> </w:tcBorders> </w:tcPr> <w:tbl> <w:tblPr> <w:tblStyle w:val=""TableGrid"" /> <w:tblpPr w:leftFromText=""180"" w:rightFromText=""180"" w:vertAnchor=""text"" w:horzAnchor=""margin"" w:tblpX=""-90"" w:tblpY=""14"" /> <w:tblOverlap w:val=""never"" /> <w:tblW w:w=""0"" w:type=""auto"" /> <w:tblBorders> <w:top w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:left w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:bottom w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:right w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:insideH w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> <w:insideV w:val=""none"" w:color=""auto"" w:sz=""0"" w:space=""0"" /> </w:tblBorders> <w:tblLayout w:type=""fixed"" /> <w:tblLook w:val=""04A0"" w:firstRow=""1"" w:lastRow=""0"" w:firstColumn=""1"" w:lastColumn=""0"" w:noHBand=""0"" w:noVBand=""1"" /> </w:tblPr> <w:tblGrid> <w:gridCol w:w=""1170"" /> <w:gridCol w:w=""630"" /> <w:gridCol w:w=""720"" /> <w:gridCol w:w=""1440"" /> <w:gridCol w:w=""630"" /> <w:gridCol w:w=""720"" /> <w:gridCol w:w=""1080"" /> <w:gridCol w:w=""630"" /> </w:tblGrid> <w:tr w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidTr=""00284F47""> <w:tc> <w:tcPr> <w:tcW w:w=""1170"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""auto"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00284F47""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> <w:r w:rsidRPr=""00284F47""> <w:rPr> <w:b /> </w:rPr> <w:t>Subscore:</w:t> </w:r> <w:r> <w:rPr> <w:b /> </w:rPr> <w:t>:</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""630"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""DBE5F1"" w:themeFill=""accent1"" w:themeFillTint=""33"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00F56BE2""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:b /> </w:rPr> <w:t>" + dr["HeaderSubScore"].ToString() + @"</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""720"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""auto"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00284F47""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""1440"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""auto"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00284F47"" w:rsidRDefault=""00284F47""> <w:pPr> <w:rPr> <w:b /> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:b /> </w:rPr> <w:t>Discard Rate:</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""630"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""DBE5F1"" w:themeFill=""accent1"" w:themeFillTint=""33"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00F56BE2""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:b /> </w:rPr> <w:t>" + dr["HeaderDiscardRate"].ToString() + @"</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""720"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""auto"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00284F47""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""1080"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""auto"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00284F47""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:b /> </w:rPr> <w:t>C2 Rate:</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w=""630"" w:type=""dxa"" /> <w:shd w:val=""clear"" w:color=""auto"" w:fill=""DBE5F1"" w:themeFill=""accent1"" w:themeFillTint=""33"" /> </w:tcPr> <w:p w:rsidRPr=""00284F47"" w:rsidR=""00284F47"" w:rsidP=""00B702EB"" w:rsidRDefault=""00F56BE2""> <w:pPr> <w:jc w:val=""center"" /> <w:rPr> <w:b /> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:b /> </w:rPr> <w:t>" + dr["HeaderScore"].ToString() + @"</w:t> </w:r> </w:p> </w:tc> </w:tr> </w:tbl> <w:p w:rsidR=""00284F47"" w:rsidP=""00284F47"" w:rsidRDefault=""00284F47"" /> </w:tc> </w:tr>"); #endregion //tmpGrid.Append(headerRow); //tmpGrid.Append(headerRow2); tableHeader.Append(tableProperties1.CloneNode(true)); tableHeader.Append(tmpGrid); tableHeader.Append(headerRow); tableHeader.Append(headerRow2); tables.Add(new customSection(tableHeader)); //Add "Region/Method" header tableBody = new Table(); tableBody.Append(tableProperties1.CloneNode(true)); tableBody.Append(gridBody.CloneNode(true)); tableBody.Append(header.CloneNode(true)); } TableRow row = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; string col = dr["CommonName"].ToString(); row.Append(getCell(col, clrBlueLt, "1000", clrGreyText, true)); string col1 = dr["Factor1Score"].ToString() + ":" + dr["Factor1ScoreDescription"].ToString(); row.Append(getCell(col1, "FFFFFF", "1000")); string col2 = dr["Factor2Score"].ToString() + ":" + dr["Factor2ScoreDescription"].ToString(); row.Append(getCell(col2, "FFFFFF", "1000")); string col3 = dr["Factor3Score"].ToString() + ":" + dr["Factor3ScoreDescription"].ToString(); row.Append(getCell(col3, "FFFFFF", "1000")); string col5 = dr["SubScore"].ToString(); row.Append(getCell(col5, "FFFFFF", "1000", true)); tableBody.Append(row); } tables.Add(new customSection(tableBody)); //store last table return tables; }
private List<customSection> getCriteria4Grid(DataTable dt) { //Set up TableProperties TableProperties tableProperties1 = new TableProperties(); TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" }; TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto }; TableIndentation tableIndentation1 = new TableIndentation() { Width = 0, Type = TableWidthUnitValues.Dxa }; TableLook tableLook1 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }; tableProperties1.Append(tableStyle1); tableProperties1.Append(tableWidth1); tableProperties1.Append(tableIndentation1); tableProperties1.Append(tableLook1); //Species header (need as separate grid b/c only one column) TableGrid gridHeader = new TableGrid(); gridHeader.Append(new GridColumn() { Width = "8725" }); //Body TableGrid gridBody = new TableGrid(); gridBody.Append(new GridColumn() { Width = "3325" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); gridBody.Append(new GridColumn() { Width = "1350" }); //Title bar TableRow header = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; header.Append(getCell("Region / Method", clrBlueMid, "3325", clrBlueText, true)); header.Append(getCell("Gear Type and \r\nSubstrate", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("Mitigation of \r\nGear Impacts", clrBlueMid, "1350", clrBlueText, true)); header.Append(getCell("EBFM", clrBlueMid, "1350", clrBlueText,true)); header.Append(getCell("Overall Recomm.", clrBlueMid, "1890", clrBlueText, true)); Table tableHeader = new Table(); Table tableBody = new Table(); List<customSection> tables = new List<customSection>(); //Add "Region/Method" header tableBody = new Table(); tableBody.Append(tableProperties1.CloneNode(true)); tableBody.Append(gridBody.CloneNode(true)); tableBody.Append(header.CloneNode(true)); foreach (DataRow dr in dt.Rows) { TableRow row = new TableRow() { RsidTableRowAddition = "003C5001", RsidTableRowProperties = "003C5001" }; string col = dr["Location"].ToString() + " " + dr["BodyOfWater"].ToString() + "\r\n" + dr["Method"].ToString(); row.Append(getCell(col, clrBlueLt, "1000", clrGreyText, true)); string col1 = dr["Factor1Score"].ToString() + ":" + dr["Factor1ScoreDescription"].ToString(); row.Append(getCell(col1, "FFFFFF", "1000")); string col2 = dr["Factor2Score"].ToString() + ":" + dr["Factor2ScoreDescription"].ToString(); row.Append(getCell(col2, "FFFFFF", "1000")); string col3 = dr["Factor3Score"].ToString() + ":" + dr["Factor3ScoreDescription"].ToString(); row.Append(getCell(col3, "FFFFFF", "1000")); string col5 = dr["Color"].ToString() + " (" + dr["Score"].ToString() + ")"; row.Append(getCell(col5, getColor(dr["Color"].ToString()), "1000", true)); tableBody.Append(row); } tables.Add(new customSection(tableBody)); //store last table return tables; }