资源简介
只需要在前台传对应的Jsona 跟字段过去就可以了
代码片段和文件信息
package com.cider.javapos2015.servlet.common;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jxl.CellType;
import jxl.Workbook;
import jxl.format.CellFormat;
import jxl.write.Alignment;
import jxl.write.Border;
import jxl.write.BorderLinestyle;
import jxl.write.Colour;
import jxl.write.Label;
import jxl.write.NumberFormat;
import jxl.write.VerticalAlignment;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WriteException;
import net.sf.json.JSONArray;
import net.sf.json.JSONobject;
import com.cider.javapos2015.tools.GetDataFromSysvar;
public class ServletExportExcel extends HttpServlet{
private static final long serialVersionUID = 1L;
private static WritableCellFormat wcf_c = null;
private static WritableCellFormat wcf_n = null;
private Double sys_toexcel_line = 0.0;
// private static final int maxFormatRecordsIndex = Integer.MAX_VALUE;
//
// private static final int maxFormatRecordsIndex = Integer.MAX_VALUE;
@Override
protected void doGet(HttpServletRequest req HttpServletResponse resp)
throws ServletException IOException {
this.doPost(req resp);
}
@Override
protected void doPost(HttpServletRequest req HttpServletResponse resp)
throws ServletException IOException {
req.setCharacterEncoding(“UTF-8“);
resp.setCharacterEncoding(“UTF-8“);
// resp.setContentType(“octets/stream“);
//PrintWriter pw = resp.getWriter();
String ExcelHeader = req.getParameter(“ExcelHeader“);
String ExcelContext = req.getParameter(“ExcelContext“);
String fileName = req.getParameter(“ExcelFileName“);
//System.out.println(ExcelContext);
JSONArray ExcelHeaderA = JSONArray.fromobject(ExcelHeader);
JSONArray ExcelContextA = JSONArray.fromobject(ExcelContext);
if(fileName==null || fileName.equals(““) || fileName.equals(“undefined“)){
fileName=java.util.UUID.randomUUID().toString()+“.xls“;
}
//System.out.println(“attachment;fileName=“+URLEncoder.encode(fileName “UTF-8“));
resp.setHeader(“content-disposition“ “attachment;fileName=“+URLEncoder.encode(fileName “UTF-8“));
object tmpsysvar = GetDataFromSysvar.getSysvar(“sys_toexcel_line“);
if(tmpsysvar!=null){
sys_toexcel_line =(Double) tmpsysvar;
}
// String filePath = ServletActionContext.getServletContext().getRealPath(“/xls/“ + qh.getQuoid().trim() + “.xls“);
// String modelPath = ServletActionContext.getServletContext().getRealPath(“/xlsmodel/quo.xls“);
// File myFile = new File(filePath);
// File myFile2 = new File(modelPath);
//
// try {
// if(!myFile.exists()){
// myFil
相关资源
- jxl.jar包最新jar包亲测可用
- poi 解析excel生成html
- java导出30万数据量的excel采用生成多个
- easyexcel-好用的java Excel工具
- Android代码-easyexcel
- jxls-jexcel-1.0.6.jar
- excel动态图表模板
- Java读写Excel的jar包
- excel所需所有jar包
- Java实现Excel导入导出
- java读取excel ,xls和xlsx
- jxl包/jar包
- aspose.cell for java破解版
- java的workbook类的jar包
- Java poi导入导出EXCEL工具类兼容各版本
- 银行交易流水excel表分析-树结构a转账
-
poi-ooxm
l-3.7-20101029.jar -
poi-ooxm
l-4.1.2.jar - NPOI 2.5.1.0_new.zip
- android POI 读取excel 精简jar
- Java实现word excel ppt转pdf
- java实现Excel数据导入到数据库
- java把excel表的数据导入到mysql数据库
- poi-3.8-20120326.jar
- java 操作Excel表格用到的jar 包
- excel文档数据转SQL插入语句insert的工具
- java 生成并excel
- Java导出Excel文件
- Java导出数据到Excel通用类,有使用范
- 快速、简单避免OOM的java处理Excel工具
评论
共有 条评论