internal static void AddElectricalMaterialSheet(XLWorkbook workbook, TECBid bid, string sheetName = "Wire and Conduit") { List <IControllerConnection> connections = getAllConnections(bid); List <LengthSummaryItem> wireItems = consolidateWire(connections); List <LengthSummaryItem> conduitItems = consolidateConduit(connections); List <CostSummaryItem> costItems = consolidateCostInConnections(connections); List <RatedCostSummaryItem> ratedItems = consolidateRatedCostInConnections(connections); IXLWorksheet worksheet = workbook.Worksheets.Add(sheetName); int row = 1; row = worksheet.insertTitleRow("Wire", row); row++; row = worksheet.insertLengthHeaders(row); foreach (LengthSummaryItem item in wireItems) { row = worksheet.insertLengthItem(item, row); } row++; row = worksheet.insertTitleRow("Conduit", row); row++; row = worksheet.insertLengthHeaders(row); foreach (LengthSummaryItem item in conduitItems) { row = worksheet.insertLengthItem(item, row); } row++; row = worksheet.insertTitleRow("Associated Costs", row); row++; row = worksheet.insertCostHeaders(row); foreach (CostSummaryItem item in costItems) { row = worksheet.insertCostItem(item, row); } row++; row = worksheet.insertTitleRow("Rated Costs", row); row++; row = worksheet.insertRatedCostHeaders(row); foreach (RatedCostSummaryItem item in ratedItems) { row = worksheet.insertRatedCostItem(item, row); } row++; worksheet.formatFinal(); }