Yes, JasperReports has an API that allows you to do this. The cornerstone of this is the JasperDesign class, which represents your report in-memory. You should check out the No XML Design Sample, which uses the API extensively to build a report from scratch only using java. Once I had seen that example, I found that by exploring the javadoc from the JasperDesign class, I could quite easily find any method I needed to change elements on a report.
As an example, a basic approach for changing the font on an element would be to first load your JRXML into a JasperDesign object, find the element by its key, then call setFontName
:
JasperDesign design = JRXmlLoader.load("path/to/your/JRXML.file");
JRElement element;
for (JRBand band : design.getDetailSection().getBands()) {
element band.getElementByKey("elementName");
}
if (element != null) {
((JRDesignTextElement) element).setFontName("Arial");
}
See this question for how to add a new band. The method of doing so changed in recent versions, so a lot of the examples and tutorials online are out of date.
When you are done modifying/creating your report, you can save it or compile it like so:
JasperCompileManager.writeReportToXmlFile(design, "path/to/your/output.jrxml");
JasperCompileManager.compileReportToFile(design, "path/to/your/output.jasper");