Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:22:36+00:00 2026-05-26T13:22:36+00:00

I have tried to generate a dynamic report using DynamicReports but always I am

  • 0

I have tried to generate a dynamic report using DynamicReports but always I am getting following exception,can anyone give me a solution.

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: net.sf.jasperreports.engine.base.JRBaseStyle.getParagraph()Lnet/sf/jasperreports/engine/JRParagraph;
    at net.sf.dynamicreports.jasper.transformation.StyleTransform.abstractStyle(StyleTransform.java:116)
    at net.sf.dynamicreports.jasper.transformation.StyleTransform.style(StyleTransform.java:74)
    at net.sf.dynamicreports.jasper.transformation.StyleTransform.addStyle(StyleTransform.java:65)
    at net.sf.dynamicreports.jasper.transformation.StyleTransform.transform(StyleTransform.java:59)
    at net.sf.dynamicreports.jasper.base.JasperReportDesign.transform(JasperReportDesign.java:104)
    at net.sf.dynamicreports.jasper.base.JasperReportDesign.<init>(JasperReportDesign.java:77)
    at net.sf.dynamicreports.jasper.base.JasperReportDesign.<init>(JasperReportDesign.java:69)
    at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReportDesign(JasperReportBuilder.java:215)
    at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.getJasperParameters(JasperReportBuilder.java:242)
    at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperPrint(JasperReportBuilder.java:252)
    at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.show(JasperReportBuilder.java:281)
    at ClsManufac.ClsDynamicReport.build(ClsDynamicReport.java:43)
    at ClsManufac.ClsDynamicReport.<init>(ClsDynamicReport.java:30)
    at Manufacturing.FrmMonthlyStock.jButton1ActionPerformed(FrmMonthlyStock.java:335)
    at Manufacturing.FrmMonthlyStock.access$400(FrmMonthlyStock.java:23)
    at Manufacturing.FrmMonthlyStock$5.actionPerformed(FrmMonthlyStock.java:148)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253)
    at java.awt.Component.processMouseEvent(Component.java:6175)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:5940)
    at java.awt.Container.processEvent(Container.java:2105)
    at java.awt.Component.dispatchEventImpl(Component.java:4536)
    at java.awt.Container.dispatchEventImpl(Container.java:2163)
    at java.awt.Component.dispatchEvent(Component.java:4362)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055)
    at java.awt.Container.dispatchEventImpl(Container.java:2149)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4362)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

I have a JTable and a JButton in my JFrame, what I need is to generate a report using DynamicReport (http://dynamicreports.sourceforge.net/) from the data of the JTable when click the button.
What I do when clicking the button is, passing the table model to the following class, and try to loop through the table model to generate the report.

package com;


import java.awt.Color;

import java.awt.Font;
import static net.sf.dynamicreports.report.builder.DynamicReports.*;

import static net.sf.dynamicreports.report.builder.DynamicReports.*;

import java.math.BigDecimal;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import net.sf.dynamicreports.examples.DataSource;
import net.sf.dynamicreports.jasper.builder.JasperReportBuilder;
import net.sf.dynamicreports.report.builder.DynamicReports;
import net.sf.dynamicreports.report.builder.style.StyleBuilder;
import net.sf.dynamicreports.report.constant.HorizontalAlignment;
import net.sf.dynamicreports.report.constant.LineStyle;
import net.sf.dynamicreports.report.exception.DRException;
import net.sf.jasperreports.engine.JRDataSource;
import org.apache.commons.lang.Validate;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.collections.ReferenceMap;
import org.apache.commons.digester.Rule;

public class SimpleReport {

    DefaultTableModel model;

    public SimpleReport(DefaultTableModel model) {
        this.model = model;
        build();
    }

    private void build() {

        StyleBuilder boldStyle = stl.style().bold();
        StyleBuilder boldCenteredStyle = stl.style(boldStyle).setHorizontalAlignment(HorizontalAlignment.CENTER);
        StyleBuilder columnTitleStyle = stl.style(boldCenteredStyle);
        StyleBuilder titleStyle = stl.style(boldStyle).setHorizontalAlignment(HorizontalAlignment.CENTER);

        try {
            JasperReportBuilder report = DynamicReports.report();
            report()//create new report design
                    .setColumnTitleStyle(columnTitleStyle).columns(//add columns
                    //            title,     field name     data type
                    //col.columnRowNumberColumn("No").setHorizontalAlignment(HorizontalAlignment.CENTER),
                    col.column("ID", "ID", type.stringType()).setHorizontalAlignment(HorizontalAlignment.LEFT),
                    col.column("Name", "Name", type.stringType()).setHorizontalAlignment(HorizontalAlignment.CENTER),
                    col.column("Phone", "Phone", type.stringType()).setHorizontalAlignment(HorizontalAlignment.CENTER)).title(cmp.text("Getting started\n").setStyle(titleStyle))//shows report title
                    .pageFooter(cmp.pageXofY())//shows number of page at page footer
                    .setDataSource(createDataSource())//set datasource
                    .show();//create and show report
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private JRDataSource createDataSource() {
        DataSource dataSource = new DataSource("ID", "Name", "Phone");



        for (int i = 0; i < model.getRowCount(); i++) {
            System.out.println(model.getValueAt(i, 2));
            dataSource.add(model.getValueAt(i, 0), model.getValueAt(i, 1), model.getValueAt(i, 2));

        }

        return dataSource;
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:22:37+00:00Added an answer on May 26, 2026 at 1:22 pm

    DynamicReports seems to use JasperReports, but you probably have incompatible versions of both libraries in your classpath.

    Check the documentation of your version of DynamicReports to know which version of JasperReports it expects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to generate Hello World with openxml sdk. To my surprise when
Have tried to find solutions for this and can't really come up with anything.
I have tried several things so far, but I haven't had much luck yet.
I have tried this but it does not work (even if I specify .wav
I have tried quite a few codes but none of them seem to work
I'm generating a dynamic assembly using Reflection.Emit which includes a single class. I have
I have tried unsuccessfully to copy the pwd to pbcopy as follows pwd |
I have tried to make the fullscreen feature of a SDI application with splitter
I have tried to put <a href=page2.hta>Go Page 2</a> inside a .hta file. However,
i have tried till my head hurts and have been reading so much my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.