Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mindexpert7546/jasper-report-grails-learn
This repo is for get the jasper response in grails 3.2.6 or 3.x
https://github.com/mindexpert7546/jasper-report-grails-learn
grails grails3 groovy groovy-language
Last synced: about 1 month ago
JSON representation
This repo is for get the jasper response in grails 3.2.6 or 3.x
- Host: GitHub
- URL: https://github.com/mindexpert7546/jasper-report-grails-learn
- Owner: mindexpert7546
- Created: 2023-11-14T11:22:31.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-14T12:16:11.000Z (12 months ago)
- Last Synced: 2024-10-12T19:00:29.487Z (about 1 month ago)
- Topics: grails, grails3, groovy, groovy-language
- Language: CSS
- Homepage:
- Size: 189 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jasper-Report-Grails-Learn
## Learn More :
https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/blob/main/GetStart.md## Some Screen Shot :
![Screenshot 2023-11-14 164759](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/69f0495d-aa44-4658-ab85-0a5e3706384f)
![Screenshot 2023-11-14 164749](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/316ef114-bb3f-4bd5-88e8-1bbfbc05144e)
![Screenshot 2023-11-14 164809](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/35dec9c9-ed84-4dad-93f7-4ef65c4887e0)
![Screenshot 2023-11-14 164817](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/9871795a-6a62-49c4-b712-48e5f9ecd947)
![Screenshot 2023-11-14 164823](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/fa15b90e-ce0e-4a4b-b487-242a22e1a064)
![Screenshot 2023-11-14 164840](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/2aafaf11-545f-40a0-96a1-4cba4d3b06d2)
![Screenshot 2023-11-14 164936](https://github.com/mindexpert7546/Jasper-Report-Grails-Learn/assets/89348788/ad873a97-a567-4fa1-a5be-2635b359478c)## Dependency grails 3.x
```
compile "com.lowagie:itext:2.1.7"
compile("net.sf.jasperreports:jasperreports:5.6.1") {
exclude group: 'antlr', module: 'antlr'
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.ant', module: 'ant'
exclude group: 'mondrian', module: 'mondrian'
exclude group: 'commons-javaflow', module: 'commons-javaflow'
exclude group: 'net.sourceforge.barbecue', module: 'barbecue'
exclude group: 'xml-apis', module: 'xml-apis'
exclude group: 'xalan', module: 'xalan'
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
exclude group: 'org.hibernate ', module: 'hibernate'
exclude group: 'javax.xml.soap', module: 'saaj-api'
exclude group: 'javax.servlet', module: 'servlet-api'
exclude group: 'org.springframework', module: 'spring-core'
exclude group: 'org.beanshell', module: 'bsh'
exclude group: 'org.springframework', module: 'spring-beans'
exclude group: 'jaxen', module: 'jaxen'
exclude group: 'net.sf.barcode4j ', module: 'barcode4j'
exclude group: 'org.apache.xmlgraphics', module: 'batik-svg-dom'
exclude group: 'org.apache.xmlgraphics', module: 'batik-xml'
exclude group: 'org.apache.xmlgraphics', module: 'batik-awt-util'
exclude group: 'org.apache.xmlgraphics', module: 'batik-dom'
exclude group: 'org.apache.xmlgraphics', module: 'batik-css'
exclude group: 'org.apache.xmlgraphics', module: 'batik-gvt'
exclude group: 'org.apache.xmlgraphics', module: 'batik-script'
exclude group: 'org.apache.xmlgraphics', module: 'batik-svggen'
exclude group: 'org.apache.xmlgraphics', module: 'batik-util'
exclude group: 'org.apache.xmlgraphics', module: 'batik-bridge'
exclude group: 'javax.persistence', module: 'persistence-api'
exclude group: 'eclipse', module: 'jdtcore'
exclude group: 'org.olap4j', module: 'olap4j'
}compile "org.apache.poi:poi:3.10-FINAL"
compile "commons-io:commons-io:2.5"
compile 'net.sf.jasperreports:jasperreports:6.20.0'
```
### Sample code for Domain class :```
package jasperreportclass Product {
String name
static constraints = {
}
}
```## Sample code for Controller :
```
package jasperreport
import net.sf.jasperreports.engine.JasperFillManager
import net.sf.jasperreports.engine.JasperCompileManager
import net.sf.jasperreports.engine.JasperExportManager
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSourceclass ProductController {
def index() {
/// Fetch data from the database or any other source
def data = Product.list()// Choose a specific product for demonstration (you might want to fetch it differently)
def specificProduct = data.first()// Compile the JasperReport template
//perfect path : C:\Users\Kundan Kumar\Desktop\jasperReport\src\main\webapp\reports/product.jrxml
def reportPath = grailsApplication.parentContext.getResource("./reports/product.jrxml").file.toString()
def jasperReport = JasperCompileManager.compileReport(reportPath)// Create parameters map
def fileParams = [:]
fileParams.put("name", specificProduct.name)// Fill the report with data and parameters
def jasperPrint = JasperFillManager.fillReport(
jasperReport,
fileParams,
new JRBeanCollectionDataSource(data)
)// Export the report to PDF and send it as the response
response.setHeader('Content-Disposition', 'inline; filename=ProductReport.pdf')
response.setContentType('application/pdf')
JasperExportManager.exportReportToPdfStream(jasperPrint, response.outputStream)
}}
```
## Sample code for jrxml :
```
```
## Ref Link :
http://beginninggroovyandgrails.blogspot.com/2017/05/migration-to-grails-3.html