<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="main" />
</head>
<body>
<div class="nav">
<span class="menuButton"><g:link class="create" action="index">Save</g:link></span>
<span class="menuButton"><g:link class="create" action="index">Cancel</g:link></span>
<span class="menuButton"><g:link class="create" action="excelExport">Export To Excel</g:link></span>
</div>
<div class="body">
<div class="message">Parsed Data:</div>
<g:hasErrors bean="${savedCrInstance}">
<div class="errors">
<g:renderErrors bean="${savedCrInstance}" as="list" />
</div>
</g:hasErrors>
<g:form method="post" >
<input type="hidden" name="id" value="${savedCrInstance?.id}" />
<input type="hidden" name="version" value="${savedCrInstance?.version}" />
<g:render template="company" model="['savedCrInstance':savedCrInstance,'customerInquiriesVal':customerInquiriesVal,'balanceStmtInfo':balanceStmtInfo,'incomeStmtInfo':incomeStmtInfo,'listofMeasures':listofMeasures]"/>
</g:form>
</div>
</body>
</html>
The above GSP displays parsed data(from PDFs) to users. The user has options to save, cancel and export the parsed data to Excel.
On click of Excel Export, I want the savedCrInstance model(which I got from controller) to be passed to another controller, where I’ll be exporting the data to excel as shown here.
First of all you need not use the export Functionality using workbooks and file etc.. as specified in the link Grails: How do I export a grails list to Microsoft Excel?.
Grails provide an export plugin which is very easy to use. Refer: http://www.grails.org/plugin/export
This case would involve an addition of an action class to the existing controller that will export the data to the excel