Commit 15d3bda7 authored by vvengurlekar's avatar vvengurlekar

TableToExcelServlet.java - is updated for working of export to excel in mobile


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182041 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a4ca565d
package ibase.server;
import ibase.utility.CommonConstants;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLDecoder;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
......@@ -64,20 +69,46 @@ public class TableToExcelServlet extends HttpServlet
String html = request.getParameter("html");
String fileName = request.getParameter("fileName");
String export = request.getParameter("export");
//added by varsha v for export to excel in mobile
String callerInterface = request.getParameter("INTERFACE");
System.out.println("callerInterface is::"+callerInterface+"\nhtml:: "+html);
OutputStream opStream = null;
//ended by varsha v for export to excel in mobile
System.out.print(" fileName is=" + fileName + " export type is =" + export);
fileName = "ExcelOutput";
//changed by Varsha V for export to excel in mobile
if ("Excel".equals(export))
{
if (!fileName.endsWith(".xls"))
if (!fileName.endsWith(".xlsx"))
{
fileName = fileName + ".xlsx";
}
if(callerInterface != null && callerInterface.length()>0)
{
String downloadedPath = CommonConstants.APPLICATION_CONTEXT + "dump/"+fileName+"";
System.out.println("downloadedPath is:"+downloadedPath);
FileOutputStream fos = new FileOutputStream( downloadedPath );
if( html != null && html.getBytes() != null )
{
fileName = fileName + ".xls";
System.out.println("inside expotdata:");
fos.write(html.getBytes());
}
fos.close();
opStream = response.getOutputStream();
opStream.write( downloadedPath.getBytes() );
opStream.flush();
opStream.close();
}
else
{
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
response.getWriter().write(html);
}
}
else if ("PDF".equals(export))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment