public PdfReportExporter(IReport rpt, ExportMode eMode, bool dMode) { report = rpt; exportMode = eMode; designMode = dMode; log = new EasilyReportLog("Pdf Report", this.GetType().FullName, LogFileInfo.logFileName, rpt); if (rpt.Format.PageHeight != 0.0) { exportByHeight = true; } else { exportByHeight = false; } }
public ExcelController(bool excelVisible, IReport report) { dtBefore = System.DateTime.Now; CurExcel = new Excel.ApplicationClass(); CurExcel.DisplayAlerts = false; dtAfter = System.DateTime.Now; CurExcel.Visible = excelVisible; //CurExcel.Workbooks.Add(true); CurExcel.Workbooks.Add(mValue); sheetIndex = 1; CurSheet = CurExcel.Worksheets[sheetIndex] as Excel.Worksheet; CurBook = CurExcel.Workbooks[1]; pictureIndex = 0; log = new EasilyReportLog("Excel Report", this.GetType().FullName, LogFileInfo.logFileName, report); }
public PdfController(IReport rpt, ExportMode exportMode, bool mExportByHeight, bool designTime, int pageWidth) { string filePath = String.Empty; this.report = rpt; mDesignTime = designTime; mPageWidth = pageWidth; ExportByHeight = mExportByHeight; log = new EasilyReportLog("Pdf Report", this.GetType().FullName, LogFileInfo.logFileName, rpt); string path = String.Empty; //System.Drawing.Font font = new System.Drawing.Font("Arial", 9.0f); //int left = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginLeft, font))); //int right = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginRight, font))); //int top = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginTop, font))); //int bottom = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginBottom, font))); double left = UnitConversion.InchToPound(this.report.Format.MarginLeft); double right = UnitConversion.InchToPound(this.report.Format.MarginRight); double top = UnitConversion.InchToPound(this.report.Format.MarginTop); double bottom = UnitConversion.InchToPound(this.report.Format.MarginBottom); pdfDoc = new Document(this.GetPageSize(rpt.Format.PageSize, rpt.Format.Orientation), (float)left, (float)right, (float)top, (float)bottom); if (exportMode == ExportMode.Export) { filePath = this.report.FilePath; } else { filePath = ExportFileInfo.PdfPreviewFilePath; } writer = PdfWriter.GetInstance(pdfDoc, new FileStream(filePath, FileMode.Create)); pdfDoc.Open(); //path = Application.StartupPath + "\\" + CliUtils.fCurrentProject + "\\"; //BaseFont.AddToResourceSearch(path + "iTextAsian.dll"); //BaseFont.AddToResourceSearch(path + "iTextAsianCmaps.dll"); //baseFont = BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED); fontPath = Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, Environment.GetFolderPath(Environment.SpecialFolder.System).LastIndexOf("\\")) + @"\Fonts"; FontFactory.RegisterDirectory(fontPath); }