| Line 21... |
Line 21... |
| 21 |
import javax.servlet.ServletOutputStream;
|
21 |
import javax.servlet.ServletOutputStream;
|
| 22 |
import javax.servlet.http.HttpServletRequest;
|
22 |
import javax.servlet.http.HttpServletRequest;
|
| 23 |
import javax.servlet.http.HttpServletResponse;
|
23 |
import javax.servlet.http.HttpServletResponse;
|
| 24 |
import javax.servlet.http.HttpSession;
|
24 |
import javax.servlet.http.HttpSession;
|
| 25 |
|
25 |
|
| - |
|
26 |
import org.apache.axis.utils.ByteArrayOutputStream;
|
| 26 |
import org.apache.poi.ss.usermodel.Row;
|
27 |
import org.apache.poi.ss.usermodel.Row;
|
| 27 |
import org.apache.poi.ss.usermodel.Sheet;
|
28 |
import org.apache.poi.ss.usermodel.Sheet;
|
| 28 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
29 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
| 29 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
30 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
| 30 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
31 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
| Line 222... |
Line 223... |
| 222 |
|
223 |
|
| 223 |
public String download() throws Exception {
|
224 |
public String download() throws Exception {
|
| 224 |
InputStream is = getClass().getClassLoader().getResourceAsStream("orderformat.xlsx");
|
225 |
InputStream is = getClass().getClassLoader().getResourceAsStream("orderformat.xlsx");
|
| 225 |
logger.info("is stream is " + (is==null?"null" : "not null"));
|
226 |
logger.info("is stream is " + (is==null?"null" : "not null"));
|
| 226 |
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
227 |
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
| - |
|
228 |
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
| 227 |
Sheet sheet = workbook.getSheetAt(0);
|
229 |
Sheet sheet = workbook.getSheetAt(0);
|
| 228 |
workbook.setSheetName(0, this.getMy());
|
230 |
workbook.setSheetName(0, this.getMy());
|
| 229 |
DateFormat df = new SimpleDateFormat("MMM, yyyy");
|
231 |
DateFormat df = new SimpleDateFormat("MMM, yyyy");
|
| 230 |
Date fromDate = df.parse(this.getMy());
|
232 |
Date fromDate = df.parse(this.getMy());
|
| 231 |
|
233 |
|
| Line 267... |
Line 269... |
| 267 |
row.createCell(++i).setCellValue(o.getStatusDescription());
|
269 |
row.createCell(++i).setCellValue(o.getStatusDescription());
|
| 268 |
row.createCell(++i).setCellValue(o.getCustomer_city());
|
270 |
row.createCell(++i).setCellValue(o.getCustomer_city());
|
| 269 |
|
271 |
|
| 270 |
}
|
272 |
}
|
| 271 |
ServletOutputStream os = response.getOutputStream();
|
273 |
ServletOutputStream os = response.getOutputStream();
|
| 272 |
workbook.write(os);
|
274 |
workbook.write(bos);
|
| - |
|
275 |
bos.writeTo(os);
|
| 273 |
String filename=this.getMy() + "-order.xlsx";
|
276 |
String filename=this.getMy() + "-order.xlsx";
|
| 274 |
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
277 |
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| 275 |
response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\"");
|
278 |
response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\"");
|
| 276 |
|
279 |
|
| 277 |
|
280 |
|