TestDesignEditInvoice.java in <insatll_root>\help\samples\APIDesign
shows how to modify a report using the methods of the Design API. It demonstrates how to change the image in the report TestInvoice.cls.
Here is an explanation of how TestDesignEditInvoice.java works with the methods provided by the Design API.
desg = new Designer(path, cat);
The constructor of Designer has two parameters: path and name. They are respectively path and name of the catalog with which the report will be created.
desg.setLog(new FileOutputStream(log), "8859_1");
The output stream log points the path and file in which to write log messages. Parameter "8859_1" is the encoding for the messages.
report = desg.open(name);
This method opens an existing report corresponding to the name specified, and returns the handle of the report.
handle = desg.getHandles(report, Designer.IMAGE, -1)[0];
This allows the handle of the object to be modified.
|
desg.exit();
For example, you can use the following command to compile the sample program:
|
When you run the sample programs, you should provide two or three parameters. If you want to use two parameters, they should be catalog path and catalog name. The command line should be:
|
If you want to use three parameters, they should be catalog path, catalog name and log file with a full path name. The command line should be:
|
Here, it is assumed that JReport Designer has been installed to C:\JReport\Designer
, and that the directory that is current when you execute these commands is C:\JReport\Designer\help\samples\APiDesign
(location of the sample programs). After running the program, you will find a modified file TestInvoice.cls in C:\JReport\Designer\Demo\Reports\TutorialReports
.