コード例 #1
0
        protected override void GenerateReportTitle()
        {
            PdfPTable titleTable = null;

            if (this.reportTitleIconStatus == ReportTitleIconStatus.Alarm)
            {
                titleTable = PdfElementGenerator.createTable(new float[] { 0.84f, 0.04f, 0.12f });
            }
            else if (this.reportTitleIconStatus == ReportTitleIconStatus.OK)
            {
                titleTable = PdfElementGenerator.createTable(new float[] { 0.89f, 0.04f, 0.07f });
            }
            else
            {
                titleTable = PdfElementGenerator.createTable(new float[] { 0.89f, 0.04f, 0.07f });
            }
            PdfPCell[] rowCells = titleTable.Rows[0].GetCells();
            if (!string.IsNullOrWhiteSpace(this.Title))
            {
                rowCells[0].Phrase = PdfElementGenerator.createDocumentTitlePhrase(this.Title.Trim() == ReportConstString.TitleDefaultString ? "" : this.Title);
            }
            if (this.reportTitleIconStatus == ReportTitleIconStatus.Alarm && reportCrossSmall != null)
            {
                rowCells[1].Image       = this.getImage(Utils.CopyToBinary(reportCrossSmall));
                rowCells[1].FixedHeight = 18;
                rowCells[2].Phrase      = PdfElementGenerator.createDocumentTitlePhrase(ReportConstString.TitleAlarmString);
            }
            else if (this.reportTitleIconStatus == ReportTitleIconStatus.OK && reportOkSmall != null)
            {
                rowCells[1].Image       = this.getImage(Utils.CopyToBinary(reportOkSmall));
                rowCells[1].FixedHeight = 18;
                rowCells[2].Phrase      = PdfElementGenerator.createDocumentTitlePhrase(ReportConstString.TitleOkString);
            }
            else
            {
                // nothing to do
            }

            rowCells[2].PaddingBottom     = 0;
            rowCells[2].VerticalAlignment = Element.ALIGN_MIDDLE;
            document.Add(titleTable);
            PdfElementGenerator.AddEmptyParagraphToDocument(this.document, this.sectionMargin);
        }