private static XLWorkbook generatePointsList(TECBid bid) { XLWorkbook workbook = new XLWorkbook(); IXLWorksheet worksheet = workbook.Worksheets.Add("Points List"); int row = 1; IXLCell titleCell = worksheet.Cell(row, "A"); titleCell.Value = "Points List"; titleCell.Style.Font.SetBold(); row += 2; worksheet.addBySystemHeaderRow(row); row++; bool rowWritten = false; IXLRow xlRow = worksheet.Row(row); foreach (TECTypical typ in bid.Systems) { foreach (TECSystem sys in typ.Instances) { xlRow.Cell("A").Value = sys.Name; rowWritten = true; foreach (TECEquipment equip in sys.Equipment) { xlRow.Cell("B").Value = equip.Name; rowWritten = true; foreach (TECSubScope ss in equip.SubScope) { xlRow.Cell("C").Value = ss.Name; string deviceString = ""; foreach (IEndDevice device in ss.Devices) { deviceString += " ("; deviceString += device.Name; deviceString += ") "; } xlRow.Cell("D").Value = deviceString; rowWritten = true; foreach (TECPoint point in ss.Points) { xlRow.Cell("E").Value = point.Label; if (point.Type == IOType.Protocol) { xlRow.Cell("F").Value = "Serial"; } else { xlRow.Cell("F").Value = point.Type.ToString(); } xlRow.Cell("G").Value = point.Quantity; rowWritten = true; if (rowWritten) { xlRow = xlRow.RowBelow(); rowWritten = false; } } if (rowWritten) { xlRow = xlRow.RowBelow(); rowWritten = false; } } if (rowWritten) { xlRow = xlRow.RowBelow(); rowWritten = false; } } xlRow = xlRow.RowBelow(); } } worksheet.Columns().AdjustToContents(); return(workbook); }