I'm trying to import net.sf.jasperreports.engine.export to export all the details of cars (number, client, constructor, type, color ..). All the information is stored in the database.
In fact, I have succeeded to generate different types of files (XML, doc, docx, pdf ..), the name were named correctly, the size is set to A4 and files can be located in the right location. But all of the lines are empty, and I want to fill the data inside. I would like to use the method fill() and use JasperFillManager in order to fill the blanks. But it doesn't work. I don't know how to use JasperFillManager in order to find all of the information. Could someone help me?
/**
* Initializes this method.
*
* @param model
* @param pageType
* @param orientation
* @param outputType
* @param destination
*/
private void init(ExportModel model, PAGE_TYPE pageType,
PAGE_ORIENTATION orientation, OUTPUT_TYPE outputType,
String destination){
this.model = model;
this.printerData = new PrinterData();
this.printerData.setUseSql(false);
this.printerData.setPageFormat(pageType);
this.printerData.setPageOrientation(orientation);
this.printerData.setOutputType(outputType);
this.printerData.setDestination(destination);
}
This is the initial of the class.
I would like to write a function:
public static void fill()
{
try
{
JasperFillManager.fillReportToFile("static.jasper",null,new JREmptyDataSource());
} catch(JRException e)
{
e.printStackTrace();
}
}
}
Thank you very much! If there is some sample code that would be better!