public void Run() { var name = "test_5_10_backslash"; Report report = new Report(jp.co.systembase.json.Json.Read(Path.Combine("rrpt", name + ".rrpt"))); report.Fill(new ReportDataSource(getDataTable())); ReportPages pages = report.GetPages(); using (FileStream fs = new FileStream(Path.Combine("out", name + ".pdf"), FileMode.Create)) { PdfRendererSetting setting = new PdfRendererSetting(); setting.ReplaceBackslashToYen = true; PdfRenderer renderer = new PdfRenderer(fs, setting); pages.Render(renderer); } }
public static void Run() { // 郵便番号フォーマッタが設定されたSettingオブジェクトを用意します ReportSetting setting = new ReportSetting(); setting.TextFormatterMap.Add("yubin", new YubinTextFormatter()); Report report = new Report(Json.Read("report\\example_extention.rrpt"), setting); report.Fill(new ReportDataSource(getDataTable())); ReportPages pages = report.GetPages(); // PDF出力 using (FileStream fs = new FileStream("output\\example_extention.pdf", FileMode.Create)) { // チェックボックスレンダラが設定されたSettingオブジェクトを用意します PdfRendererSetting pdfSetting = new PdfRendererSetting(); pdfSetting.ElementRendererMap.Add("checkbox", new PdfCheckBoxRenderer()); PdfRenderer renderer = new PdfRenderer(fs, pdfSetting); renderer.Setting.ReplaceBackslashToYen = true; pages.Render(renderer); } // XLS出力 using (FileStream fs = new FileStream("output\\example_extention.xls", FileMode.Create)) { // チェックボックスレンダラが設定されたSettingオブジェクトを用意します XlsRendererSetting xlsSetting = new XlsRendererSetting(); xlsSetting.ElementRendererMap.Add("checkbox", new XlsCheckBoxRenderer()); HSSFWorkbook workbook = new HSSFWorkbook(); XlsRenderer renderer = new XlsRenderer(workbook, xlsSetting); renderer.NewSheet("example_extention"); pages.Render(renderer); workbook.Write(fs); } // XLSX出力 using (FileStream fs = new FileStream("output\\example_extention.xlsx", FileMode.Create)) { // チェックボックスレンダラが設定されたSettingオブジェクトを用意します XlsxRendererSetting xlsxSetting = new XlsxRendererSetting(); xlsxSetting.ElementRendererMap.Add("checkbox", new XlsxCheckBoxRenderer()); XSSFWorkbook workbook = new XSSFWorkbook(); XlsxRenderer renderer = new XlsxRenderer(workbook, xlsxSetting); renderer.NewSheet("example_extention"); pages.Render(renderer); workbook.Write(fs); } // プレビュー { // チェックボックスレンダラが設定されたSettingオブジェクトを用意します GdiRendererSetting gdiSetting = new GdiRendererSetting(); gdiSetting.ElementRendererMap.Add("checkbox", new GdiCheckBoxRenderer()); FmPrintPreview preview = new FmPrintPreview(new Printer(pages, gdiSetting)); preview.StartUpZoomFit = true; preview.ShowDialog(); } }