protected override void GenerateDataList() { if (!this.isSignatureShown) { this.document.NewPage(); } PdfPTable dataListTable = null; PdfPCell[] dataListCells = null; int columnIndex = 0; float[] listCellLayout = new float[] { 0.37f, 0.43f, 0.20f }; PdfPTable cellContentTable = null; int cellDataCount = 100; int columnPerPage = 4; int dataPerPage = cellDataCount * columnPerPage; cellContentTable = PdfElementGenerator.createTable(listCellLayout, false, true); for (int i = 0; i < Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count); i++) { if (i != 0 && i % (cellDataCount - this.rowsInfectedBySignature) == 0) { if (cellContentTable != null) { dataListCells[columnIndex] = new PdfPCell(cellContentTable); } cellContentTable = PdfElementGenerator.createTable(listCellLayout, false, true); columnIndex = (i / (cellDataCount - this.rowsInfectedBySignature)) % columnPerPage; } if (i % dataPerPage == 0) { dataListTable = PdfElementGenerator.createTable(new float[] { 0.25f, 0.25f, 0.25f, 0.25f }, true); PdfPCell[] headerRowCells = dataListTable.Rows[0].GetCells(); for (int j = 0; j < headerRowCells.Length; j++) { PdfPTable headerTable = PdfElementGenerator.createTable(listCellLayout, false, true); PdfPCell[] headerCells = headerTable.Rows[0].GetCells(); headerCells[0].Phrase = PdfElementGenerator.createTableHeaderPhrase("Date"); headerCells[1].Phrase = PdfElementGenerator.createTableHeaderPhrase("Time"); headerCells[2].Phrase = PdfElementGenerator.createTableHeaderPhrase(unit); foreach (var item in headerCells) { item.HorizontalAlignment = Element.ALIGN_CENTER; //item.PaddingTop = 1f; } headerRowCells[j] = new PdfPCell(headerTable); headerRowCells[j].PaddingTop = 2f; } dataListCells = PdfElementGenerator.AddEmptyRowToTable(dataListTable, true, true); } PdfPCell[] rowCells = PdfElementGenerator.AddEmptyRowToTable(cellContentTable, false, false); rowCells[0].Phrase = PdfElementGenerator.createDataListContentPhrase(TempsenFormatHelper.GetFormattedDate(this.device.tempList[i].PointTime.ToLocalTime()), this.device.tempList[i].IsMark); rowCells[1].Phrase = PdfElementGenerator.createDataListContentPhrase(TempsenFormatHelper.GetFormattedTime(this.device.tempList[i].PointTime.ToLocalTime()), this.device.tempList[i].IsMark); rowCells[2].Phrase = PdfElementGenerator.createDataListContentPhrase(TempsenFormatHelper.GetFormattedTemperature(this.device.tempList[i].PointTemp), this.device.tempList[i].IsMark); foreach (var item in rowCells) { item.HorizontalAlignment = Element.ALIGN_CENTER; item.PaddingLeft = 0; item.PaddingRight = 0; item.PaddingTop = 0.0f; item.PaddingBottom = 0.8f; } if (i == Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count) - 1) { dataListCells[columnIndex] = new PdfPCell(cellContentTable); for (int j = columnPerPage - 1; j > columnIndex; j--) { dataListTable.Rows[0].GetCells()[j].Phrase = PdfElementGenerator.createTableHeaderPhrase(string.Empty); } this.document.Add(PdfElementGenerator.createSectionFrameTable(dataListTable, false)); cellContentTable = null; dataListTable = null; columnIndex = 0; break; } } for (int i = (cellDataCount - this.rowsInfectedBySignature) * columnPerPage; i < device.tempList.Count; i++) { int k = i - ((cellDataCount - this.rowsInfectedBySignature) * columnPerPage); if (k == 0) { cellContentTable = PdfElementGenerator.createTable(listCellLayout, false, true); } if (k != 0 && k % cellDataCount == 0) { if (cellContentTable != null) { dataListCells[columnIndex] = new PdfPCell(cellContentTable); } cellContentTable = PdfElementGenerator.createTable(listCellLayout, false, true); columnIndex = (k / cellDataCount) % columnPerPage; } if (k % dataPerPage == 0) { if (dataListTable != null) { this.document.Add(PdfElementGenerator.createSectionFrameTable(dataListTable, false)); } dataListTable = PdfElementGenerator.createTable(new float[] { 0.25f, 0.25f, 0.25f, 0.25f }, true); PdfPCell[] headerRowCells = dataListTable.Rows[0].GetCells(); for (int j = 0; j < headerRowCells.Length; j++) { PdfPTable headerTable = PdfElementGenerator.createTable(listCellLayout, false, true); PdfPCell[] headerCells = headerTable.Rows[0].GetCells(); headerCells[0].Phrase = PdfElementGenerator.createTableHeaderPhrase("Date"); headerCells[1].Phrase = PdfElementGenerator.createTableHeaderPhrase("Time"); headerCells[2].Phrase = PdfElementGenerator.createTableHeaderPhrase(unit); foreach (var item in headerCells) { item.HorizontalAlignment = Element.ALIGN_CENTER; } headerRowCells[j] = new PdfPCell(headerTable); headerRowCells[j].PaddingTop = 2f; } dataListCells = PdfElementGenerator.AddEmptyRowToTable(dataListTable, true, true); } PdfPCell[] rowCells = PdfElementGenerator.AddEmptyRowToTable(cellContentTable, false, false); rowCells[0].Phrase = PdfElementGenerator.createDataListContentPhrase(TempsenFormatHelper.GetFormattedDate(this.device.tempList[i].PointTime.ToLocalTime()), this.device.tempList[i].IsMark); rowCells[1].Phrase = PdfElementGenerator.createDataListContentPhrase(TempsenFormatHelper.GetFormattedTime(this.device.tempList[i].PointTime.ToLocalTime()), this.device.tempList[i].IsMark); rowCells[2].Phrase = PdfElementGenerator.createDataListContentPhrase(TempsenFormatHelper.GetFormattedTemperature(this.device.tempList[i].PointTemp), this.device.tempList[i].IsMark); foreach (var item in rowCells) { item.HorizontalAlignment = Element.ALIGN_CENTER; item.PaddingLeft = 0; item.PaddingRight = 0; item.PaddingTop = 0.0f; item.PaddingBottom = 0.8f; } if (i == device.tempList.Count - 1) { dataListCells[columnIndex] = new PdfPCell(cellContentTable); for (int j = columnPerPage - 1; j > columnIndex; j--) { dataListTable.Rows[0].GetCells()[j].Phrase = PdfElementGenerator.createTableHeaderPhrase(string.Empty); } this.document.Add(PdfElementGenerator.createSectionFrameTable(dataListTable, false)); break; } } }