主页 > 办公自动化 > java实现pdf模板导出excel(java导出pdf生成报表)

java实现pdf模板导出excel(java导出pdf生成报表)

2022-11-18 03:49来源:m.sf1369.com作者:宇宇

1. java导出pdf生成报表

首先需要在项目中新建一个报表(命名为XtraReport1)。还请注意,如果您希望用于打开系统中*.pdf文件的默认程序自动打开生成的文件,你可以调用StartProcess方法,示例中也有展示。

using System.Diagnostics;

using DevExpress.XtraPrinting;

using DevExpress.XtraReports.UI;

// ...

private void button1_Click(object sender, EventArgs e)

{

// A path to export a report.

string reportPath = "c:\\Test.pdf";

// Create a report instance.

XtraReport1 report = new XtraReport1();

// Get its PDF export options.

PdfExportOptions pdfOptions = report.ExportOptions.Pdf;

// Set PDF-specific export options.

pdfOptions.Compressed = true;

pdfOptions.ImageQuality = PdfJpegImageQuality.Low;

pdfOptions.NeverEmbeddedFonts = "Tahoma;Courier New";

pdfOptions.DocumentOptions.Application = "Test Application";

pdfOptions.DocumentOptions.Author = "DX Documentation Team";

pdfOptions.DocumentOptions.Keywords = "XtraReports, XtraPrinting";

pdfOptions.DocumentOptions.Subject = "Test Subject";

pdfOptions.DocumentOptions.Title = "Test Title";

// Set the pages to be exported.

pdfOptions.PageRange = "1, 3-5";

// Export the report to PDF.

report.ExportToPdf(reportPath);

// Show the result.

StartProcess(reportPath);

}

// Use this method if you want to automaically open

// the created PDF file in the default program.

public void StartProcess(string path)

{

Process process = new Process();

try

{

process.StartInfo.FileName = path;

process.Start();

process.WaitForInputIdle();

}

catch { }

}

Imports System.Diagnostics

Imports DevExpress.XtraPrinting

Imports DevExpress.XtraReports.UI

' ...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles Button1.Click

' A path to export a report.

Dim reportPath As String = "c:\\Test.pdf"

' Create a report instance.

Dim report As New XtraReport1()

' Get its PDF export options.

Dim pdfOptions As PdfExportOptions = report.ExportOptions.Pdf

' Set PDF-specific export options.

pdfOptions.Compressed = True

pdfOptions.ImageQuality = PdfJpegImageQuality.Low

pdfOptions.NeverEmbeddedFonts = "Tahoma;Courier New"

pdfOptions.DocumentOptions.Application = "Test Application"

pdfOptions.DocumentOptions.Author = "DX Documentation Team"

pdfOptions.DocumentOptions.Keywords = "XtraReports, XtraPrinting"

pdfOptions.DocumentOptions.Subject = "Test Subject"

pdfOptions.DocumentOptions.Title = "Test Title"

' Set the pages to be exported.

pdfOptions.PageRange = "1, 3-5"

' Export the report to PDF.

report.ExportToPdf(reportPath)

' Show the result.

StartProcess(reportPath)

End Sub

' Use this method if you want to automaically open

' the created PDF file in the default program.

Public Sub StartProcess(ByVal path As String)

Dim process As New Process()

Try

process.StartInfo.FileName = path

process.Start()

process.WaitForInputIdle()

Catch

End Try

End Sub

2. Java导出pdf

document.open(); // itext 显示中文 使用Windows系统字体(TrueType) BaseFont baseFont = BaseFont.createFont( "C:/Windows/Fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); Font font = new Font(baseFont); PdfPCell cell = new PdfPCell(new Phrase(“序号”, font));

3. java导出pdf文件

很简单呐,你可以参考参考我最近用的方法。感觉 步骤如下:

1.打开浏览器并进入SanPDF首页

2.点击导航栏“转换”,选择“JPG转PDF”这时候他会提醒你下载SanPDF的客户端,你点击“下载”就好了

3.进入SanPDF客户端,选择“JPG转PDF”转换功能

4.点击“”添加文件

5.点击“开始转换”

6.转换转换成功后,你可以点击“下载文件”,保存转换后的文件 希望可以帮到你~

4. java 生成pdf报表

你把安装个虚拟打印机,把虚拟打印机设置成默认打印机就可以了

5. pdf报表怎么导出来

方法/步骤分步阅读

1

/6

登录OA系统,进入“报表”导航栏;

2

/6

点击左侧导航栏“流程报表-定义报表”,在右侧窗口中就会显示流程报表清单(流程报表查看及导出功能需要申请开通权限);

3

/6

点击其中的一条流程报表,如请假申请,就会显示筛选数据的条件,可按自己的需求进行筛选,如发起人,公司,部门以及时间范围等,条件设置好后点击“搜索”;

4

/6

搜索完成后,系统就会返回相关的数据;

5

/6

如果数据符合要求,此时可点击”导出Excel"进行导出;

6

/6

也可以在查找结果页面点击鼠标右键,在弹出菜单栏中点击“导出Excel",同样可以将数据导出到Excel文件中。

6. Java报表导出

登陆电子税务局,找到财务报表这个模板,然后涉税查询,查询你需要的年份,然后导出报表

7. java实现导出pdf

几种方案:方法一:用apachepio读取doc文件,然后转成html文件用Jsoup格式化html文件,最后用itext将html文件转成pdf。方法2:使用jdoctopdf来实现,这是一个封装好的包,可以把doc转换成pdf,html,xml等格式,调用很方便地址:安装完后要启动openOffice的服务,具体启动方法请自行google方法4:效果最好的一种方法,但是需要window环境,而且速度是最慢的需要安装

8. java 导出pdf表格

Flying-Saucer + iText + Velocity1. 第一步将jar包放到你的工程里,需要的jar如下: bcprov-jdk15-140.jar core-renderer.jar iText-2.0.8.jar iTextAsian.jar velocity-1.4.jarJar包下载地址:http://code.google.com/p/flying-saucer/downloads/list;

2. 第二步设计模版,进行排版调整样式,css样式也可以导入@import 等,通过Velocity模版引擎动态替换 页面内容,以下是模版内容:

<?xml version="1.0" encoding="UTF-8" ?><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>PDF模版</title><style type="text/css"><!-- body { font: 100% Verdana, Arial, Helvetica, sans-serif; margin: 0; padding: 0; text-align: center; color: #000000; } .oneColLiqCtrHdr #container { width: 100%; margin: 0 auto; text-align: left; } div.header-left {display: none} div.header-right {display: none} div.footer-left {display: none} div.footer-right {display: none}

9. java实现PDF文件的生成

只能先解析pdf为文本、字符串,再把文本、字符串拼成xml。解析pdf可以通过iText或iTextSharp,拼成xml这个就看你自己想怎么组装了。

相关推荐

企业办公软件都有哪些?

办公自动化 2024-01-14

数控车床自动编程用什么软件?

办公自动化 2024-01-12

写字间物业管理方案

办公自动化 2023-12-09

自动化的好处和坏处

办公自动化 2023-12-05

单片机有什么特征?

办公自动化 2023-11-27

excel2007教程|excel2007教程下载

办公自动化 2023-11-22