protected override void GenerateReportTitle() { Range titleRange = this.getSectionRangeFromSummary(1); titleRange.Cells[1, 1] = this.Title.Trim() == ReportConstString.TitleDefaultString ? "" : this.Title; if (this.reportTitleIconStatus == ReportTitleIconStatus.Alarm) { Utils.SaveTheFile(Utils.CopyToBinary(reportCrossSmall), this.tempReportTitleIconPath); this.summary.Shapes.AddPicture(this.tempReportTitleIconPath, MsoTriState.msoFalse, MsoTriState.msoTrue, titleRange.Cells[1, 6].Left + 1, titleRange.Cells[1, 6].Top + 1, titleRange.Cells.Height - 1, titleRange.Cells.Height - 1); titleRange.Cells[1, 6] = string.Format(" {0}", ReportConstString.TitleAlarmString); } else if (this.reportTitleIconStatus == ReportTitleIconStatus.OK) { Utils.SaveTheFile(Utils.CopyToBinary(reportOkSmall), this.tempReportTitleIconPath); this.summary.Shapes.AddPicture(this.tempReportTitleIconPath, MsoTriState.msoFalse, MsoTriState.msoTrue, titleRange.Cells[1, 6].Left + 1, titleRange.Cells[1, 6].Top + 1, titleRange.Cells.Height - 1, titleRange.Cells.Height - 1); titleRange.Cells[1, 6] = string.Format(" {0}", ReportConstString.TitleOkString); } else { //nothing to do } titleRange.Font.Size = 12; titleRange.Font.Bold = true; }
protected override void GenerateReportHeader() { byte[] logoByte = Common.GlobalProfile.Logo; string contactInfo = Common.GlobalProfile.ContactInfo; if (logoByte != null || !string.IsNullOrWhiteSpace(contactInfo)) { Range headerRange = this.getSectionRangeFromSummary(4); if (logoByte != null) { this.tempHeaderFullPath = Path.Combine(System.Windows.Forms.Application.StartupPath, "temp", Guid.NewGuid().ToString()); Image tempImage = new Bitmap(new MemoryStream(logoByte)); //tempImage.Save(this.tempHeaderFullPath); Utils.SaveTheFile(logoByte, this.tempHeaderFullPath); int finalWidth = tempImage.Width; int finalHeight = tempImage.Height; Size originalSize = new Size((int)headerRange.Width / 2, (int)headerRange.Height); if (finalWidth > originalSize.Width) { finalHeight = (int)(finalHeight * (originalSize.Width * 1.0 / finalWidth)); finalWidth = originalSize.Width; } if (finalHeight > originalSize.Height) { finalWidth = (int)(finalWidth * (originalSize.Height * 1.0 / finalHeight)); finalHeight = originalSize.Height; } this.summary.Shapes.AddPicture(this.tempHeaderFullPath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, headerRange.Left, headerRange.Top, finalWidth, finalHeight); } headerRange.get_Range("D1", "F4").Merge(headerRange.get_Range("D1", "F4").MergeCells); headerRange.get_Range("A1", "C4").Merge(headerRange.get_Range("A1", "C4").MergeCells); headerRange[1, 4] = contactInfo; headerRange[1, 4].WrapText = true; headerRange.Font.Size = 8; } }