Running reports from Screen - DataGrid

The following lines of codes are perfectly working in browser screen using a table or Group Table according to the user guide:

 @Inject
private Button printBtn;

@Subscribe
private void onInit(InitEvent event) {

    TablePrintFormAction action = new TablePrintFormAction("report", journalsTable);
    journalsTable.addAction(action);
    printBtn.setAction(action);

}

However, it doesn’t work where I have used DataGrid in the Browser screen instead of a Table or GroupTable. Does it support for DataGrid?

Hi,

You can use ListPrintFormAction both for Table and DataGrid. Unfortunately, this feature isn’t documented yet, but we’re working on it.

Gleb

1 Like

Thank you Gleb

Hi Gleb
I have attached report that is throwing the following exception:

java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.output.ByteArrayOutputStream.needNewBuffer(ByteArrayOutputStream.java:128)
at org.apache.commons.io.output.ByteArrayOutputStream.write(ByteArrayOutputStream.java:159)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2315)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:2270)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:2246)
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:765)
at org.docx4j.fonts.fop.fonts.truetype.FontFileReader.init(FontFileReader.java:51)
at org.docx4j.fonts.fop.fonts.truetype.FontFileReader.<init>(FontFileReader.java:80)
at org.docx4j.fonts.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:217)
at org.docx4j.fonts.PhysicalFonts.getPhysicalFont(PhysicalFonts.java:298)
at org.docx4j.fonts.PhysicalFonts.addPhysicalFonts(PhysicalFonts.java:236)
at org.docx4j.fonts.PhysicalFonts.addPhysicalFont(PhysicalFonts.java:226)
at org.docx4j.fonts.PhysicalFonts.discoverPhysicalFonts(PhysicalFonts.java:173)
at org.docx4j.fonts.IdentityPlusMapper.<clinit>(IdentityPlusMapper.java:74)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.getFontMapper(WordprocessingMLPackage.java:375)
at org.docx4j.convert.out.common.preprocess.PartialDeepCopy.process(PartialDeepCopy.java:95)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:77)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:135)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:51)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:32)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:63)
at org.docx4j.Docx4J.toFO(Docx4J.java:734)
at org.docx4j.Docx4J.toPDF(Docx4J.java:749)
at com.haulmont.yarg.formatters.impl.DocxFormatter.saveAndClose(DocxFormatter.java:151)
at com.haulmont.yarg.formatters.impl.DocxFormatter.renderDocument(DocxFormatter.java:93)
at com.haulmont.yarg.reporting.Reporting.generateReport(Reporting.java:133)
at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:100)
at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:83)
at com.haulmont.reports.ReportingBean.createReportDocument(ReportingBean.java:346)
at com.haulmont.reports.ReportingBean.createReportDocument(ReportingBean.java:315)
at com.haulmont.reports.ReportingBean.createReport(ReportingBean.java:209)

It seems that there is an issue related to font. How can this be fixed?

The report file is attached
Report for entity Vendor Credit Note.zip|attachment (10.6 KB)

any suggestions?

Is it related to the PDF converter pack in new versions as I remember it worked (from docx to pdf) without an OpenOffice pack installed but recently it’s no more working.

java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.fonts.IdentityPlusMapper
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.getFontMapper(WordprocessingMLPackage.java:375)
at org.docx4j.convert.out.common.preprocess.PartialDeepCopy.process(PartialDeepCopy.java:95)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:77)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:135)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:51)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:32)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:63)
at org.docx4j.Docx4J.toFO(Docx4J.java:734)
at org.docx4j.Docx4J.toPDF(Docx4J.java:749)

I am getting the following error from my another application hosted in Ubuntu too. What is the reason of this “Permission denied” message thrown?

java.io.FileNotFoundException: .docx4j (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at org.docx4j.fonts.fop.fonts.FontCache.saveTo(FontCache.java:199)
at org.docx4j.fonts.fop.fonts.FontCache.save(FontCache.java:184)
at org.docx4j.fonts.PhysicalFonts.discoverPhysicalFonts(PhysicalFonts.java:201)
at org.docx4j.fonts.IdentityPlusMapper.<clinit>(IdentityPlusMapper.java:74)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.getFontMapper(WordprocessingMLPackage.java:375)
at org.docx4j.convert.out.common.preprocess.PartialDeepCopy.process(PartialDeepCopy.java:95)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:77)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:135)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:51)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:32)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:63)
at org.docx4j.Docx4J.toFO(Docx4J.java:734)
at org.docx4j.Docx4J.toPDF(Docx4J.java:749)
at com.haulmont.yarg.formatters.impl.DocxFormatter.saveAndClose(DocxFormatter.java:151)
at com.haulmont.yarg.formatters.impl.DocxFormatter.renderDocument(DocxFormatter.java:93)
at com.haulmont.yarg.reporting.Reporting.generateReport(Reporting.java:133)
at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:100)
at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:83)
at com.haulmont.reports.ReportingBean.createReportDocument(ReportingBean.java:346)
at com.haulmont.reports.ReportingBean.createReportDocument(ReportingBean.java:315)
at com.haulmont.reports.ReportingBean.createReport(ReportingBean.java:209)
at com.haulmont.reports.ReportServiceBean.createReport(ReportServiceBean.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:116)
at sun.reflect.GeneratedMethodAccessor893.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy1716.createReport(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:206)
at com.sun.proxy.$Proxy1828.createReport(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:215)
at com.haulmont.cuba.core.sys.remoting.CubaRemoteInvocationExecutor.invoke(CubaRemoteInvocationExecutor.java:110)
at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)
at com.haulmont.cuba.core.sys.remoting.HttpServiceExporter.handleRequest(HttpServiceExporter.java:81)
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:53)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at com.haulmont.cuba.core.sys.remoting.RemotingServlet.doService(RemotingServlet.java:126)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1591)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Hi,

Could you please create a separate topic?

Gleb

Thanks, posted here