protected override void GenerateSignatures() { if (this.isSignatureShown) { Range signatureTitleRange = this.getSectionRangeFromSummary(1); signatureTitleRange[1, 1] = "Electronic Signatures"; this.setSectionTitleStyleForRange(signatureTitleRange, 1); Range signatureHeaderRange = this.getSectionRangeFromSummary(1, false); signatureHeaderRange.Borders.Color = Color.Black; signatureHeaderRange[1, 1] = "Index"; signatureHeaderRange[1, 2] = "User Name"; signatureHeaderRange[1, 3] = "Full Name"; signatureHeaderRange[1, 4] = "Meaning"; signatureHeaderRange[1, 5] = "Date"; signatureHeaderRange[1, 6] = "Time"; this.setTableHeaderStyleForRange(signatureHeaderRange, 1); Range range = this.getSectionRangeFromSummary(this.signatureList.Count, false, true); range.Borders.Color = Color.Black; for (int i = 0; i < this.signatureList.Count; i++) { string index = (i + 1).ToString(); string userName = this.signatureList[i].UserName; string fullName = this.signatureList[i].FullName; string meaning = this.signatureList[i].MeaningDesc; string date = TempsenFormatHelper.GetFormattedDate(this.signatureList[i].SignTime.ToLocalTime()); string time = TempsenFormatHelper.GetFormattedTime(this.signatureList[i].SignTime.ToLocalTime()); range[i + 1, 1] = index; range[i + 1, 2] = userName; range[i + 1, 3] = fullName; range[i + 1, 4] = meaning; range[i + 1, 5] = date; range[i + 1, 6] = time; this.setTableCellContentStyleForRange(range, i + 1); } } Range testRange = this.getSectionRangeFromSummary(3); }
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; } } }
protected override void GenerateDataList() { IList <PointKeyValue> dataList = this.device.tempList; TableLayoutPanel dataListTable = null; int columnIndex = 0; int cellContentSectionWidth = (DefaultSectionWidth - 4) / 3; int cellDataCount = 100; int columnPerPage = 4; int dataPerPage = cellDataCount * columnPerPage; SectionControl cellContentSection = null; SectionControl tableHearderSection = null; dataListTable = this.CreateDataListTableLayoutPanel(true); dataListTable.Top = this.currentSectionTop + sectionMargin * 2; for (int i = 0; i < Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count); i++) { if (i % (cellDataCount - this.rowsInfectedBySignature) == 0) { if (cellContentSection != null) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); } tableHearderSection = new SectionControl(false); cellContentSection = new SectionControl(false); cellContentSection.IsDataListContentSection = true; dataListTable.Controls.Add(cellContentSection); dataListTable.Controls.Add(tableHearderSection); tableHearderSection.Width = cellContentSectionWidth; cellContentSection.Width = cellContentSectionWidth; cellContentSection.IsContentWithSmallFont = true; tableHearderSection.IsContentWithSmallFont = true; tableHearderSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.IsBorderShown = false; tableHearderSection.IsBorderShown = false; tableHearderSection.DefaultRowHeight = 16; cellContentSection.DefaultRowHeight = 11.2f; tableHearderSection.SetHeader(new string[] { "Date", "Time", unit }); columnIndex = (i / (cellDataCount - this.rowsInfectedBySignature)) % columnPerPage; } cellContentSection.AddRow(new string[] { TempsenFormatHelper.GetFormattedDate(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTime(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTemperature(dataList[i].PointTemp), dataList[i].IsMark.ToString() }); if (i == Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count) - 1) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); this.AddSection(dataListTable); this.GenerateReportFooter(); cellContentSection = null; dataListTable = null; } } for (int i = (cellDataCount - this.rowsInfectedBySignature) * columnPerPage; i < device.tempList.Count; i++) { int j = i - ((cellDataCount - this.rowsInfectedBySignature) * columnPerPage); if (j % dataPerPage == 0) { if (dataListTable != null) { this.AddSection(dataListTable); } dataListTable = this.CreateDataListTableLayoutPanel(); } if (j % cellDataCount == 0) { if (cellContentSection != null) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); } tableHearderSection = new SectionControl(false); cellContentSection = new SectionControl(false); cellContentSection.IsDataListContentSection = true; dataListTable.Controls.Add(cellContentSection); dataListTable.Controls.Add(tableHearderSection); tableHearderSection.Width = cellContentSectionWidth; cellContentSection.Width = cellContentSectionWidth; cellContentSection.IsContentWithSmallFont = true; tableHearderSection.IsContentWithSmallFont = true; tableHearderSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.IsBorderShown = false; tableHearderSection.IsBorderShown = false; tableHearderSection.DefaultRowHeight = 16; cellContentSection.DefaultRowHeight = 11.2f; tableHearderSection.SetHeader(new string[] { "Date", "Time", unit }); columnIndex = (j / cellDataCount) % 4; } cellContentSection.AddRow(new string[] { TempsenFormatHelper.GetFormattedDate(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTime(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTemperature(dataList[i].PointTemp), dataList[i].IsMark.ToString() }); if (i == device.tempList.Count - 1) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); this.AddSection(dataListTable); this.GenerateReportFooter(); } } }