I-Net Clear Report Engine is an excellent tool which also can support standard HTML/CSS well. You can define rpt template by clear designer, and can create datasource to query result from database, pass parameter by java......
import java.io.FileOutputStream;
import com.inet.report.Datasource;
import com.inet.report.Engine;
/**
* @Class name: IClearTest.java
*
* Short description on the purpose of the program.
*
* @author: wangxiang
* @modified: 2011-11-30
*
*/
public class IClearTest {
private static boolean useStdout=false;
private static String reportFile = "file:D:/Report4.rpt";
/**
* @param args
*/
static void usage () {
System.err.println("Usage: ProgrammingTheEngine [--use-stdout]");
System.exit(1);
}
/**
* Checks if parameter values has been set.
* @param args first parameter is stdout, second parameter is report file URL
*/
static void getOpt (String[] args) {
for (int i = 0; i< args.length; i++) {
if (args[i].equals("--use-stdout")) {
useStdout = true;
System.err.println("writing PDF file to stdout");
}
else if (args[i].equals("--report")) {
reportFile = args[++i];
} else {
usage();
}
}
}
/**
* Executes a report and exports it to PDF.
* @param args first parameter is stdout, second parameter is report file URL
*/
public static void main(String[] args) {
getOpt(args);
try {
// Create an engine -> pdf export
Engine engine = new Engine(Engine.EXPORT_PDF);
// Set the report file
engine.setReportFile(reportFile);
// At this point you can change the default values from the rpt file, e.g.:
// Change Data Source Configuration - Use another database at runtime as at design time
Datasource ds = engine.getDatabaseTables().getDatasource(0);
ds.setDataSourceConfigurationName( "ORCL" ); // name of the Data Source Configuration
ds.setUsername("userid"); // that should be used for creation of database connection
ds.setPassword("password"); // If the password is not saved in Data Source Configuration
// Set Parameter Field values
engine.setPrompt("htmlContent", "<table><tr><td>test</td></tr></table>");
// Start the report execution
engine.execute();
// Open the output file and save the data in a .pdf file or in standard out
java.io.OutputStream pdfFile;
if(useStdout) {
pdfFile = System.out;
} else {
pdfFile = new FileOutputStream("D:/cleartest.pdf");
}
// Request all report pages from the engine
for(int i=1;i<=engine.getPageCount();i++) {
pdfFile.write(engine.getPageData(i));
}
if(useStdout) {
pdfFile.flush();
} else {
pdfFile.close();
}
} catch (Throwable t ) {
t.printStackTrace();
}
System.exit(0);
}
}
分享到:
相关推荐
+ added support of /PAGE tag in TfrxRichView, engine automatically break report pages when find /PAGE tag + added ability to hide Null values in TfrxChartView (TfrxChartView.IgnoreNulls = True) + ...
- **Report(报告)**:提供机器的工作状态报告,有助于诊断问题。 - **Configuration(配置)**:用于查看和修改复印机的配置设置,如网络设置等。 - **Supplies Information(耗材信息)**:显示耗材的使用情况,...
启点CE过NP中文December 24 2018:Cheat Engine 6.8.2 Released: Here's a new version for the hollidays. Mainly minor improvements and some small bugfixes, but also a new 'ultimap like' feature called ...
report.ParameterFields["YourParameterName"].CurrentValues.Clear(); report.ParameterFields["YourParameterName"].CurrentValues.Add("ParameterValue"); ``` 此外,水晶报表支持导出报表为多种格式,如PDF、...
Added: the 64-bit structured storage engine (SSG-5), which enables you to create large database files (>2GiB), and encrypt data on the fly using AES-256 while saving information into your database. ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...
22. Clear Initial Form Fields V2.1.1 For Adobe Dreamweaver 23. Close All Documents V1.0.5 For Adobe Dreamweaver 24. Close Bowser Window V1.2.0 For Adobe Dreamweaver 25. Close Button 1.1.1 For Adobe ...