Git Product home page Git Product logo

yarg's Introduction

YARG

license Build Status Download

YARG is an open source reporting library for Java, developed by Haulmont.

It is intended to be embedded into enterprise IT systems, thus it comes with no UI so that native UI of the target system can be used. Templates can be created in most common formats including MS Office (doc, docx, xls, xlsx, html, ftl, csv) or a custom text format and filled with data loaded by sql, groovy or other means.

YARG is a mature and well-tested tool, already used in a number of Haulmont's solutions as part of CUBA Platform.

Documentation

How to add dependency

Yarg versions are distributed using a repository located at Haulmont server: https://repo.cuba-platform.com/content/groups/work

You can find the complete list of versions here: https://repo.cuba-platform.com/content/groups/work/com/haulmont/yarg/

Gradle:

repositories {
    maven {
        url "https://repo.cuba-platform.com/content/groups/work"
    }
}
...
dependencies {
    compile 'com.haulmont.yarg:yarg:2.2.14'
}

Maven:

<repositories>
    <repository>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <id>repo-cuba-platform-work</id>
        <name>repo</name>
        <url>https://repo.cuba-platform.com/content/groups/work</url>
    </repository>
</repositories>
...
<dependency>
    <groupId>com.haulmont.yarg</groupId>
    <artifactId>yarg</artifactId>
    <version>2.2.14</version>
    <type>pom</type>
</dependency>

Samples

Forums

yarg's People

Contributors

aleksey-stukalov avatar alex-haulmont avatar andreysubbotin avatar desire456 avatar gavrilov-ivan avatar gecrepo avatar gglcrash avatar gorbunkov avatar grebesche avatar haulmont-git avatar ilya-c avatar jreznot avatar knstvk avatar nikitashchienko avatar soraksh avatar tinhol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yarg's Issues

Generate wrong calcChain.xml

I have a large xlsx file that contains one summary sheet that refers to 30 other sheets.
I can generate the report without error with Yarg. However, when I open the output xlsx file, it errors out saying there problem in the content and asking me if I want to correct it or not. If I click yes, it prompts message: Removed Records: Formula from /xl/calcChain.xml part (Calculation properties).
I can remove /xl/calcChain.xml with manually, so it force Excel to regenerate automatically when open it. However, I wonder why it doesn't generate correctly in the beginning.

How to integrate with a webapp using Spring MVC

Hello, I'd like to know what value to set to documentPath if using this in a web application.

This was the guide I used:
https://github.com/Haulmont/yarg/wiki/Quick-start

currently, I set it to a local path. And it works perfectly.
However, if I deploy it to the cloud, what location should I set it to?

incomes.xml

<report name="report">
    <templates>
        <template code="DEFAULT" documentName="incomes.xlsx" documentPath="D:\\localpath\\incomes.xlsx" outputType="xlsx" outputNamePattern="incomes.xlsx"/>
    </templates>
    <rootBand name="Root" orientation="H">
        <bands>
            <band name="Header" orientation="H"/>
            <band name="Incomes" orientation="H">
                <queries>
                    <query name="Data_set_1" type="groovy">
                        <script>
                            return [['month':'Jan', 'profit':10000], ['month': 'Feb', 'profit': 12000], ['month': 'March', 'profit': 15000], ['month': 'Apr', 'profit': 12000]]
                        </script>
                    </query>
                </queries>
            </band>
            <band name="Footer" orientation="H"/>
            <band name="Chart" orientation="H"/>
        </bands>
        <queries/>
    </rootBand>
</report>

This is my controller.

ReportController.java

    @RequestMapping(value="/reports/getpdf", method=RequestMethod.GET)
    public @ResponseBody ResponseEntity<byte[]> getPDF() throws IOException {
        ClassLoader classLoader = getClass().getClassLoader();
        File file = new File(classLoader.getResource("incomes.xml").getFile());
        Report report = new DefaultXmlReader().parseXml(readFileToString(file));

        Reporting reporting = new Reporting();
        reporting.setFormatterFactory(new DefaultFormatterFactory());
        reporting.setLoaderFactory(
                new DefaultLoaderFactory()
                        .setGroovyDataLoader(new GroovyDataLoader(new DefaultScriptingImpl())));

        ReportOutputDocument reportOutputDocument = reporting.runReport(new RunParams(report));

        byte[] contents = reportOutputDocument.getContent();

        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
        String filename = "output.xlsx";
        headers.set("Content-Disposition", "attachment; filename=" + filename);
        headers.setContentLength(contents.length);
        headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");

        ResponseEntity<byte[]> response = new ResponseEntity<byte[]>(contents, headers, HttpStatus.OK);
        return response;
    }

Overlapping band regions

Hi team
How can i properly handle overlapping named regions in xlsx template ?
By overlapping regions, I mean regions that contain cells in common.

When regions of two band overlap, output document is not properly generated

Best regards

Paging in a docx or xlsx report

Hi

I want to create a master detail report such that in every page 30 lines of detail records will be placed whereas master record will be repeated in each page. How can i do it with YARG ?

Regards

Complex Excel formatting and other questions

Hello!

I am search for Excel and Word reports generator and YARG looks very interesting.

I have variety of questions and there are the most important for me:

  1. Can I make sorting and grouping by several columns with subtotals and "+"/"-" buttons in Excel report using YARG?
  2. Can I use complex colouring (also in Excel report): one colour for odd rows, other for even rows and another for subtotal rows?
  3. AFAIK I can't load data from Java ResultSet (or CachedResultSet) out of the box in the YARG. How do you think is it complicated to implement such data loader?

4.a) Can I write macros to excel file?
4.b) Can I execute macros (I think no)?

Thanks a lot!

Capitals are not supported in aliases and named regions

Capitals in aliases, value formats and named regions in templates are not supported, images are not displayed.
For example:

  • select qrCode.imageArray as "{color:red}I{color}mageArray" from sample$QRReport e left join e.qrCode qrCode
  • ${Head.{color:red}Q{color}Rcodeimage}

See the project attached and the [https://www.cuba-platform.ru/support/topic/%D0%B4%D0%BE%D0%B1%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5-%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F-%D0%B2-%D0%BE%D1%82%D1%87%D0%B5%D1%82-docx issue].


Original issue: https://youtrack.haulmont.com/issue/YARG-20

Caused by: com.haulmont.yarg.exception.DataLoadingException: An error occurred while loading data for data set

getting this error while exporting a report of over 1500 record of table to pdf using word as template

com.haulmont.yarg.exception.DataLoadingException: An error occurred while loading data for band [Items] and query [Items]. Report name []
at com.haulmont.yarg.reporting.DataExtractorImpl.getQueryData(DataExtractorImpl.java:189)
at com.haulmont.yarg.reporting.DataExtractorImpl.getQueriesResult(DataExtractorImpl.java:140)
at com.haulmont.yarg.reporting.DataExtractorImpl.getBandData(DataExtractorImpl.java:105)
at com.haulmont.yarg.reporting.DataExtractorImpl.createBands(DataExtractorImpl.java:76)
at com.haulmont.yarg.reporting.DataExtractorImpl.extractData(DataExtractorImpl.java:60)
at com.haulmont.yarg.reporting.Reporting.loadBandData(Reporting.java:143)
at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:103)
at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:82)
Caused by: com.haulmont.yarg.exception.DataLoadingException: An error occurred while loading data for data set [Items]
at com.haulmont.yarg.loaders.impl.GroovyDataLoader.loadData(GroovyDataLoader.java:52)
at com.haulmont.yarg.reporting.DataExtractorImpl.getQueryData(DataExtractorImpl.java:185)
... 9 more
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!

Filling table with data in docx breaks on certain documents

Example of the document:
https://db.tt/DOEZpKTW

In this sample, "##band=ride " will not be parsed by DocxFormatter because, although it was entered as a single piece of text, it was split by microsoft word into multiple "text" elements ("##","band", ...). And so DocxFormatter.RegexpFinder fails to detect this text as matching band name pattern "##band=([A-z_0-9]+) *"

Library not available in maven central repo

Please make this library availbale through maven central repository. many java projects are built using maven, and its always more convenient to use dependencies from central repo than to use jars or custom repositories.

Thanks in advance!

Remove BootstrapException in BootstrapConnector.connect

Can this be changed to throw the original exception? There are a variety of things that can happen in the original exception that are hidden by wrapping it in a BootstrapException since the original isn't added to the stacktrace, instead it's in a separate getter that you'd have to get by going through the exception stack since it's wrapped again before we get it into an OpenOfficeException. I ask this because it was difficult for me to tell what was going on with a problem I had using yarg in an updated EC2 Beanstalk environment where a permission change in the tomcat home directory prevented it from making a .openoffice directory and it was immediately clear when I did my own version of BootstrapConnector that returned the original error.

Generate wrong calcChain.xml

Hello! I can generate the report without error with Yarg. However, when I open the output xlsx file, it errors out saying there problem in the content and asking me if I want to correct it or not. If I click yes, it prompts message: Removed Records: Formula from /xl/calcChain.xml part (

Calculation properties). After report becomes good. Please help me to generate report correctly in the beginning.
CodeReport.txt
Report.xlsx

Not able set Table as band

Hi,
I am trying to build Excel report using excel template with Table inside , but getting error

java.lang.NullPointerException
	at com.haulmont.yarg.formatters.impl.xlsx.Document.clearWorkbook(Document.java:246)
	at com.haulmont.yarg.formatters.impl.XlsxFormatter.renderDocument(XlsxFormatter.java:87)
	at com.haulmont.yarg.reporting.Reporting.generateReport(Reporting.java:133)

can any one help me out ..

My Sample Code below :
Template file
incomes.xlsx

Code:

 public void testIncomesReport() throws Exception {
        Report report = new DefaultXmlReader()
                .parseXml(readFileToString(new File("./incomes.xml")));

        Reporting reporting = new Reporting();
        reporting.setFormatterFactory(new DefaultFormatterFactory());
        reporting.setLoaderFactory(
                new DefaultLoaderFactory()
                        .setGroovyDataLoader(new GroovyDataLoader(new DefaultScriptingImpl())));

        ReportOutputDocument reportOutputDocument = reporting.runReport(
                new RunParams(report), new FileOutputStream("./result_incomes.xlsx"));
    }

Xml Data :

<?xml version="1.0" encoding="UTF-8"?>

<report name="report">
    <templates>
        <template code="DEFAULT" documentName="incomes.xlsx" documentPath="./incomes.xlsx" outputType="xlsx" outputNamePattern="incomes.xlsx"/>
    </templates>
    <rootBand name="Root" orientation="H">
        <bands>
		 <band name="TableData" orientation="H">
                <queries>
                    <query name="Data_set_1" type="groovy">
                        <script>
                            return [['COL0':'Jan', 'COL1':10000], ['COL0': 'Feb', 'COL1': 12000], ['COL0': 'March', 'COL1': 15000], ['COL0': 'Apr', 'COL1': 12000]]
                        </script>
                    </query>
                </queries>
            </band>
        </bands>
        <queries/>
    </rootBand>
</report>

Maps returned by ReportDataLoader.loadData() are being modified

I use custom ReportDataLoader to provide report parameters. In loadData(), I return a list of immutable maps.

And when I try to build report, I get

java.lang.UnsupportedOperationException
    at com.google.common.collect.ImmutableMap.putAll(ImmutableMap.java:342)
    at com.haulmont.yarg.reporting.DataExtractorImpl.getBandData(DataExtractorImpl.java:108)
    at com.haulmont.yarg.reporting.DataExtractorImpl.createBands(DataExtractorImpl.java:74)
    at com.haulmont.yarg.reporting.DataExtractorImpl.extractData(DataExtractorImpl.java:58)
    at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:115)
    at com.haulmont.yarg.reporting.Reporting.runReport(Reporting.java:73)
            ....

because of elements are being added to the map I returned.

This behavior is really non obvious. You should either document the requirement for ReportDataLoader to return mutable maps capable of storing unknown number of additional elements, or make a copy of returned data.

Lists in Lists

Hi,

first i want to thank you for developing yarg it is a very nice idea and i like your approach of templating with office documents.

I have an Issue with Displaying Lists in Lists in an DOCX File. I'm trying to figure out what to put in the template to get it working.

Let's take the invoice example. I want to create a report which contains multiple Invoices and puts the Invoicenumer over the corresponding list of items.

So basically i have the root band (level 1), a header band (level 2) , an Invoices band (level 2) and a positions band (level 3).

The documentation is missing this part and the sample "nestedbands" neither is very clear on it.

Could you provide some more information on how to achieve my goal with yarg? Is it even possible?

Kind Regards

Jan

Define named ranges in Report output file

Hi,

i've a question about the usage of named ranges in XLSX templates.

As described in the Formatters section the bands should have equivalents in the Name regions section of the excel template. In the template file for the incomes example you created these name ranges:

  • Incomes
  • Header
  • Footer
  • Chart

What i don't really get is the following situation:

When something like a chart or a formula within the template references these data regions, why they are not referencing them by their name. An example of this can be found in your article about chart creation. In this image about the data reference the reference goes to $B$2 in the sheet. After executing the report, the data goes from $B$2 to $B$5 - nevertheless, the diagram is able to find out that this is the data region, not only $B$2 anymore. I find this really interesting that it seems to work, although i can't imagine how - perhaps i'm just missing the point.

I would have expected it to work when the following change would have been made:

  1. The diagram references not $B$2 but "Incomes" via the name
  2. In the resulting output file the name range "Incomes" exists and the value is $B$2:$B$5.

I got a little stuck while trying to do that with a pivot table and reference the defined name range for the data of the pivot table.

PS: i'm using YARG via the CUBA platforms integration.

Perhaps you can either give me a little hint why the name ranges are not part of the output file and it works anyway, or alternatively if there is a change to get the updated name ranges in the output file so that other elements of the template can reference it via the name.

Bye,
Mario

Report crashes if the named range is of whole rows

Take the test report and additional info from here: https://www.cuba-platform.com/support/topic/error-message-when-generating-report

  1. create an XLSX report
  2. in the report template adjust named region from whole rows, without specifying columns: like $Sheet1.$1:$3
  3. complete the report setup
  4. run the report

AR:

om.haulmont.reports.exception.ReportingException: An error occurred while rendering band [header]. Template name [tf10000109.xlsx] Report name [Print_Titles]
Index: 2, Size: 1

	at com.haulmont.reports.ReportingBean.createReportDocument(ReportingBean.java:288)
	at com.haulmont.reports.ReportingBean.createReport(ReportingBean.java:171)
	at com.haulmont.reports.ReportServiceBean.createReport(ReportServiceBean.java:38)
	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:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
	at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:115)
	at sun.reflect.GeneratedMethodAccessor130.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:629)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy215.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 com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:94)
	at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:148)
	at com.sun.proxy.$Proxy53.createReport(Unknown Source)
	at com.haulmont.reports.gui.ReportGuiManager.getReportResult(ReportGuiManager.java:209)
	at com.haulmont.reports.gui.ReportGuiManager.printReportSync(ReportGuiManager.java:193)
	at com.haulmont.reports.gui.ReportGuiManager.printReport(ReportGuiManager.java:179)
	at com.haulmont.reports.gui.report.run.InputParametersWindow.printReport(InputParametersWindow.java:62)
	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 com.haulmont.cuba.gui.xml.DeclarativeAction.actionPerform(DeclarativeAction.java:92)
	at com.haulmont.cuba.web.gui.components.WebButton.performAction(WebButton.java:44)
	at com.haulmont.cuba.web.gui.components.WebButton.lambda$new$61446b05$1(WebButton.java:36)
	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 com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
	at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1037)
	at com.vaadin.ui.Button.fireClick(Button.java:377)
	at com.haulmont.cuba.web.toolkit.ui.CubaButton.fireClick(CubaButton.java:54)
	at com.vaadin.ui.Button$1.click(Button.java:54)
	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 com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:119)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:444)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:409)
	at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274)
	at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90)
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1422)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:385)
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:278)
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:187)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)


Original issue: https://youtrack.haulmont.com/issue/YARG-18

Migrating from 1.0.59 to 2.x

Hi,

Is there any documentation on the significant changes between 1.0.59 and 2.x? I'm considering upgrading our application to the new version but I'm trying to evaluate the risk/reward.

Thanks!

Boolean values in XLSX reports are always false if printed in PDF or opened in OpenOffice

See: https://www.cuba-platform.com/support/topic/boolean-value-changes-when-rendering-to-pdf
Maybe it is a known issue. and occurs due to XLSX and MS Office incompatibility.

  1. In some entity add boolean field
  2. Using wizard create an XLSX report for the entity of list of entities
  3. Adjust output type = XLSX or PDF
  4. Print the report

AR: When output type = PDF true values are always ''false''. When output type = XLSX and report is opened in OOO - true values are always false too.

!image.png!


Original issue: https://youtrack.haulmont.com/issue/YARG-22

Inlining html not working

Hi,
i'm trying to execute the Word Generation Example with yours test case InvoiceTest.class but the html inlining does not work. The report is correctly generated except for the ${Main.signature} variable
Below my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>it.my</groupId>
    <artifactId>yarg</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>yarg</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.haulmont.yarg</groupId>
            <artifactId>yarg</artifactId>
            <version>1.0.54</version>
        </dependency>
    </dependencies>
</project>

An my test case:

public class InvoiceTest {
    @Test
    public void testInvoiceReportRaw() throws Exception {
        ReportBuilder reportBuilder = new ReportBuilder();
        ReportTemplateBuilder reportTemplateBuilder = new ReportTemplateBuilder()
                .documentPath("/Users/user/Documents/workspace/yarg/src/test/resources/invoice.docx")
                .documentName("invoice.docx")
                .outputType(ReportOutputType.pdf)
                .readFileFromPath();
        reportBuilder.template(reportTemplateBuilder.build());
        BandBuilder bandBuilder = new BandBuilder();
        ReportBand main = bandBuilder.name("Main").query("Main", "return [\n" +
                "                              [\n" +
                "                               'invoiceNumber':99987,\n" +
                "                               'client' : 'Google Inc.',\n" +
                "                               'date' : new Date(),\n" +
                "                               'addLine1': '1600 Amphitheatre Pkwy',\n" +
                "                               'addLine2': 'Mountain View, USA',\n" +
                "                               'addLine3':'CA 94043',\n" +
                "                               'signature':'<html><body><b>Mr. Yarg</b></body></html>'\n" +
                "                            ]]", "groovy").build();


        bandBuilder = new BandBuilder();
        ReportBand items = bandBuilder.name("Items").query("Items", "return [\n" +
                "                                ['name':'Java Concurrency in practice', 'price' : 15000],\n" +
                "                                ['name':'Clear code', 'price' : 13000],\n" +
                "                                ['name':'Scala in action', 'price' : 12000]\n" +
                "                            ]", "groovy").build();

        reportBuilder.band(main);
        reportBuilder.band(items);
        reportBuilder.format(new ReportFieldFormatImpl("Main.signature", "${html}"));

        Report report = reportBuilder.build();

        Reporting reporting = new Reporting();
        reporting.setFormatterFactory(new DefaultFormatterFactory());
        reporting.setLoaderFactory(
                new DefaultLoaderFactory().setGroovyDataLoader(new GroovyDataLoader(new DefaultScriptingImpl())));

        ReportOutputDocument reportOutputDocument = reporting.runReport(
                new RunParams(report), new FileOutputStream("/Users/user/Documents/workspace/yarg/src/test/resources/invoice_out_groovy.pdf"));
    }
}

If a field with ${html} Value format is inlined in the DOCX report other contents may be corrupted

A test-project could be downloaded here https://github.com/IskandarovRost/pictureTest

Found in 6.4. and 6.3.

  1. The "PrintMe" entity has ByteArray field, and String field hyperText
  2. Created a report 'TestHTMLInlining' (find .zip in the root directory)
  3. In the report field formats are adjusted to print
    hyperText as ${html}
  4. Create several instances of the "PrintMe" entity, add pictures and fill ''hyperText''

"<.html><.b>Mr. Yarg<./font><./b><./body><./html>"

  1. Print the report

AR: If a field with ${html} Value format is inlined in the DOCX report other contents may be corrupted
!Image.png!


Original issue: https://youtrack.haulmont.com/issue/YARG-7

An error occurred while running task in Open Office server

Getting the below error :

java.lang.RuntimeException: com.haulmont.yarg.exception.ReportingException: An error occurred while running task in Open Office server

when i try to do the process of Excel template to Pdf output in linux server , it works fine in Windows but not in linux server. i tried with OpenOffice and LibreOffice

Link to community/place to ask questions

Every great library needs a place where its users can ask questions/share experience/etc. It would be very nice to have a link (in readme.md) to google group/mailing list/stackoverflow tag/any other place you prefer for questions/proposals/etc.

After generating the excel file using excel template issue

Hi ,
Getting a Issue like when i open excel file after generating from excel template .

After open the file it is promoting to we found a problem with some content in 'file', Do you want us to try to recover as much as we can ? here is the error log below ...

when click yes, below is showing in error log...

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
 	<logFileName>error167560_01.xml</logFileName>
 	<summary>Errors were detected in file 'filepath.xlsx'</summary>
 	<removedRecords>
		<removedRecord>Removed Records: Cell information from /xl/worksheets/sheet1.xml part</removedRecord>
 	</removedRecords>
 </recoveryLog>

LibreOffice applications are killed when Tomcat stops after a report which uses soffice was printed

Linux Ubuntu 16.04 + LibrteOffice 5.1.6.2
On windows - the same

  1. Create a project with reporting, adjust path to LibreOffice
  2. Start some LibreOffice application(writer or calc), make some changes in the document
  3. Start the CUBA application in Studio
  4. Using wizard create a report with XLSX template and output type = PDF
  5. Print the report
  6. Stop the application Tomcat

AR: The soffice process is killed. Libreoffice application is closed. The document changes might be missed.


Original issue: https://youtrack.haulmont.com/issue/YARG-39

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.