title: Vaadin TreeGrid Export
body: <p>We are using both grid and treegrid in our application. And for downloading the data into excel we are using Haijian Exporter. This exporter is working fine with Grid, But it is not working with TreeGrid. When we click on the Export we are getting an error. I'm using the Haijian exporter 2.0.2 version in my application. Below is the code that I'm using for TreeGrid:</p>
  <pre><code>@Override
  protected void buildLayout()
  {
      setSizeFull();
      setMargin(true);
      setSpacing(false);
      addStyleName(&quot;layoutMargin&quot;);
  
      HeaderComponent header = new HeaderComponent(&quot;Locations&quot;, true);
  
      CssLayout filterSection = new CssLayout();
      filterSection.setWidth(100, Unit.PERCENTAGE);
      filterSection.addStyleName(&quot;view-filter&quot;);
  
      Button newLocation = new Button(&quot;New Location&quot;);
      newLocation.setSizeUndefined();
      newLocation.setStyleName(ValoTheme.BUTTON_FRIENDLY);
      newLocation.addClickListener(event -&gt; {
          toggleDetails();
          item = new Location();
          locationTreeGrid.setItems(item);
          toggleDetails();
      });
      locationTreeGrid = createTreeGridTable();
  
      Button export = new Button(&quot;Export&quot;);
      export.setIcon(VaadinIcons.LIST_UL);
      export.addStyleName(&quot;move-right&quot;);
      StreamResource excelStreamResource = new StreamResource(() -&gt; Exporter.exportAsExcel(locationTreeGrid), &quot;Locations Report.xlsx&quot;);
      FileDownloader excelFileDownloader = new FileDownloader(excelStreamResource);
      excelFileDownloader.extend(export);
      header.addComponent(export);
  
      filterSection.addComponents(newLocation);
  
      locationTreeGrid.addItemClickListener(newGridDetailsListener(locationTreeGrid));
      addComponents(header, filterSection, locationTreeGrid);
      setExpandRatio(locationTreeGrid, 1f);
  }
  
  private TreeGrid createTreeGridTable()
  {
      setEnabled(true);
  
      TreeGrid&lt;Location&gt; locationTreeGrid = new TreeGrid();
      locationTreeGrid.setSizeFull();
      locationTreeGrid.addStyleName(&quot;tree-grid-class&quot;);
      locationTreeGrid.setColumnReorderingAllowed(false);
      locationTreeGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
      locationTreeGrid.addColumn(Location::getCode).setCaption(&quot;Code&quot;).setId(&quot;Code&quot;);
      locationTreeGrid.addColumn(Location::getName).setCaption(&quot;Name&quot;).setId(&quot;Name&quot;);
      locationTreeGrid.addColumn(Location::getDisplayPath).setCaption(&quot;Path&quot;).setId(&quot;Path&quot;);
  
      locationTreeGrid.setDetailsGenerator(rowRef -&gt;
      {
          LocationDetailsView detailsView = new LocationDetailsView(listener);
          if(rowRef != null)
              detailsView.edit(rowRef);
          return detailsView;
      });
      locationTreeGrid.getEditor().setEnabled(true);
      return locationTreeGrid;
  }
  </code></pre>
  <p>Error:</p>
  <pre><code>org.vaadin.haijian.ExporterException: An error happened during exporting your Grid
      at org.vaadin.haijian.FileBuilder.build(FileBuilder.java:55)
      at org.vaadin.haijian.Exporter.exportAsExcel(Exporter.java:25)
      at org.vaadin.haijian.Exporter.exportAsExcel(Exporter.java:13)
      at com.iodine.imc.ui.views.sections.admin.locations.LocationsView.lambda$1(LocationsView.java:89)
      at com.vaadin.server.StreamResource.getStream(StreamResource.java:143)
      at com.vaadin.server.FileDownloader.handleConnectorRequest(FileDownloader.java:167)
      at com.vaadin.server.ConnectorResourceHandler.handleRequest(ConnectorResourceHandler.java:90)
      at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1608)
      at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:464)
      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.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
      at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
      at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      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:541)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
      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:1598)
      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)
  Caused by: java.lang.IllegalArgumentException: Hierarchical data provider doesn't support non-hierarchical queries
      at com.vaadin.data.provider.HierarchicalDataProvider.size(HierarchicalDataProvider.java:51)
      at org.vaadin.haijian.FileBuilder.buildRows(FileBuilder.java:115)
      at org.vaadin.haijian.FileBuilder.buildFileContent(FileBuilder.java:66)
      at org.vaadin.haijian.FileBuilder.build(FileBuilder.java:51)
      ... 76 common frames omitted
  </code></pre>