Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 10561
  • Last Modified:

How to make excel export using display tag library export my list/table?

Hi there,

I am trying to export to excel using the display tag library.

The data displays fine. However, when I click "Excel" export, it creates an excel file with the html code for the entire page but the data part is cut off.

QUESTION: using display tag library, how do I export only the table ( including the entire list regardless of paging) being displayed and not the entire html source for the page?

Appreciate all suggestions. Thanks!
0
cs_chick99
Asked:
cs_chick99
  • 6
  • 4
1 Solution
 
cs_chick99Author Commented:
Increasing the points due to time crunch urgency
0
 
mrcoffee365Commented:
It's hard to offer general advice without seeing the example code which is breaking.

Posted the code you are using (the key parts of it anyway, including required configuration settings), and perhaps part of the example wrong results.

Have you checked your configuration, and the display tag documentation?
http://displaytag.sourceforge.net/11/export.html
0
 
Tomas Helgi JohannssonCommented:
  Hi!

In your web.xml config for the display tag lib try to change
export.decorated from true to false.

Regards,
   Tomas Helgi
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
cs_chick99Author Commented:
TomasHeigl > did you mean to set this in the displaytag.properties file or the web.xml? I tried it in the displaytag.properties but the wrong export still occured.

mrcoffee365:
There is no "problem" code as there are no exceptions ever thrown. When trying to export, the export occurs "successfully" BUT instead of the data being exported, the html for the page is inserted into the excel file.

--- displaytag.properties ---
sort.amount=list
export.banner=<div align="left">Export to: {0}</div>
export.types=excel
export.excel=true
export.csv=false
export.xml=false
export.excel.filename=report.xls
export.amount=list
export.decorated=false


Everyhing works fine except that the export produces the wrong output.

Expected: the data display in the table using the display tag library should be exported
Actual: the actual html source for the entire page is being exported BUT without the data table.

Is there anywhere else that explicit export setup needs to be done?

0
 
cs_chick99Author Commented:
web.xml contains the export filter as given on Source Forge
displaytag.properties is as shown in comment above

In the JSP:

<display:table name="${sessionScope.data}" class="fw_cssTable" id="leadsData" sort="list" export="true" pagesize="10" requestURI="/viewReports.do">
                <display:column property="m_SalesLeadId" title="ID" class="fw_cssTableRow" headerClass="fw_csstableHeader" sortable="true" />
                <display:column property="m_CustCompanyNm" title="Company name" class="fw_cssTableRow" headerClass="fw_csstableHeader" />
</display:table>



Any suggestions for the cause of the data being exported incorrectly? All suggestions welcome! Thanks :o)
0
 
cs_chick99Author Commented:
UPDATE: I realized that this error appears to be caused due to using Tiles.

When I go to my tiled page, the export doesn't work properly.
When I go directly to the jsp which contains the display tag, it xports correctly.

Any suggestions please?
0
 
cs_chick99Author Commented:
mrcoffee365: yes I have specified the override filter in my web.xml...
0
 
mrcoffee365Commented:
In that case, it sounds as if you have the configuration set up correctly.  Have you checked your logs for exceptions?

If you do not find any exceptions, and the page produced does not give you any errors, just HTML with your desired spreadsheet data, then we cannot debug further without more information.  If you post the code which produces the page, and the resulting page, then we might be able to get further.

In reading the displaytag forum, and other comments about Tiles, it seems clear that there are often problems producing an Excel file with the Tiles layer.  It might be that you will have to debug the Tiles code itself, or create the export page as a direct link to the JSP page rather than using Tiles.
0
 
cs_chick99Author Commented:
The problem is with Tiles. Without using Tiles it works as per mrcoffee365's suggestion. Otherwise, I was unable to find a solution to use Tiles and have the excel export work.
0
 
mrcoffee365Commented:
It's good that it works in JSP, so you have a workaround.  I often find that the tag libraries have to be modified to do a specific task (although this is probably an actual bug, and not just a customization requirement).  There are a lot of benefits to open source products, but for the new tools, the extra debugging they require is the downside.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now