Issue 175: opening a dialog box to save the export to (pdf, csv, excel)
Status:  Invalid
Owner: ----
Closed:  Jan 2009
Reported by bhaveshs...@gmail.com, Jan 6, 2009
when clicking on export to pdf, csv, the result is displayed in the same
page. Can we open a dialog box to save the files in the location we choose
rather than displaying it in the same page?



Export to excel displays:
"org.apache.poi.hssf.usermodel.HSSFWorkbook@1624585 "

But export to pdf and csv works fine. What could be the problem with export
to excel ?


Jan 6, 2009
Project Member #1 jeff.johnston.mn@gmail.com
You might want to try the JExcel and Excel to see if one of them works for you.

As for the dialog, you should be getting that automatically. Just as a test do you
get the dialog when you run the examples war file? That would tell us if it is more
of an environmental issue or something with how the exports are working within your
application. We might have to define the response headers slightly different. First
let me know if you run the examples war file exports ok.
Jan 7, 2009
#2 bhaveshs...@gmail.com
Thanks Jeff for your quick reply.
The examples.war seems to work properly.
But I'm still having problem with export with 'excel' or 'jexcel' and table getting
displayed in the same page for pdf and csv (no dialog box pops up).

I am using the JSP tags.

<%@ taglib prefix="jmesa" uri="/WEB-INF/jmesa.tld" %>



<link rel="stylesheet" href="<html:rewrite page='/stylesheet/jmesa.css'/>"
media="screen" type="text/css">


<script type="text/javascript" language="javascript" src="<html:rewrite
page='/javascript/jquery-1.2.6.min.js'/>"></script>
<script type="text/javascript" language="javascript" src="<html:rewrite
page='/javascript/jquery.jmesa.js'/>"></script>
<script type="text/javascript" language="javascript" src="<html:rewrite
page='/javascript/jmesa.js'/>"></script>



<form name="test" action="<c:out
value="${pageContext.request.contextPath}/issues/listIssueTypes.do"/>">
<jmesa:tableFacade
        id="issueTag"
        items="${issueTypes}"
        stateAttr="restore"
        var="issueType"
        maxRows="2"
        exportTypes="csv,excel,pdf"
        maxRowsIncrements="2,4,6"  >
  <jmesa:htmlTable caption="ISSUE TYPES" width="500px">
    <jmesa:htmlRow>

        <jmesa:htmlColumn property="name" titleKey="common.headers.name" />
        <jmesa:htmlColumn property="active" titleKey="Active" /> 
 
        <jmesa:htmlColumn title="Action" sortable="false" filterable="false">
          <a href="<c:out
value="${pageContext.request.contextPath}/issues/editIssueType.do?typeId=${issueType.id}"/>">
              <html:img src="../images/edit_icon.gif" 
                  titleKey="common.actions.edit" 
                  altKey="common.actions.edit"/>
          </a>
        </jmesa:htmlColumn>
  
    </jmesa:htmlRow>
  </jmesa:htmlTable>
</jmesa:tableFacade>

</form>

<script language="javascript">

  function onInvokeAction(id) {
    setExportToLimit(id, '');
    createHiddenInputFieldsForLimitAndSubmit(id);
  }
  function onInvokeExportAction(id) {
    var parameterString = createParameterStringForLimit(id);
    location.href = '${pageContext.request.contextPath}/issues/listIssueTypes.do?' +
parameterString;
  }
    
</script>

Do I need to modify my request parameter?


I have the jars for Excel export : poi-3.0.1.jar 
and JExcel export: jexcel-2.6.6.jar added to the build properties.

when i have 
exportTypes="csv,excel,pdf"

And I click on export excel I get this displayed on the page:
 org.apache.poi.hssf.usermodel.HSSFWorkbook@1624585

and when i have:
       exportTypes="csv,jexcel,pdf"

and I click on exort excel I get :
  jxl.write.biff.WritableWorkbookImpl@d36d73  , displayed

and on the location of page i have:
"issues/listIssueTypes.do?issueTag_p_=1&issueTag_mr_=2&issueTag_e_=jexcel&issueTag_tr_=true"


Jan 7, 2009
Project Member #3 jeff.johnston.mn@gmail.com
Are you building your exports in the controller? You would need to do that. There is
a tutorial for that with a short explanation for the reason why. Your table is set up
right in the JSP though.

https://code.google.com/p/jmesa/wiki/ExportTutorial

If you already are building your exports in your controller could you tell me what
framework you are using (Spring, Struts, etc...)?

Also, if you wouldn't mind posting on the Google groups that would be more convenient
for other people to follow the thread...

http://groups.google.com/group/jmesa?pli=1

Jan 25, 2009
Project Member #4 jeff.johnston.mn@gmail.com
(No comment was entered for this change.)
Status: Invalid
Apr 12, 2010
#5 hankpai0...@gmail.com
Hi,jeff.
UnfortunatetlyI met the same problem to.I am using
struts2+hibernate+spring2.5.6,everything looks fine unless this problem.

Whem I compare evey place to your example in the debug mode.
I found that in my app,this sentence"Limit limit = tableFacade.getLimit();" get
nothing,and the example app get the exportType="excel" and the "if
(limit.isExported()) {.........}" has never been read.

can you help me? 

Apr 13, 2010
Project Member #6 jeff.johnston.mn@gmail.com
Can you post your code? The JavaScript onInvokeExportAction() as well.