表单的导入和导出怎么些代码呢

例如,将scott中的员工表单,上的数据导出,来到word文档中,打开最后在word中,添加数据,在导入到数据库在做个查看怎么做

我写过导入excel到数据库,希望能帮到你http://blog.csdn.net/qq_37552993/article/details/70919925

http://www.cnblogs.com/zyw-205520/p/3762954.html
导入word里?导入excel简单一点。

我刚做了导出word的,用的freemaker,
/**
*@author jiangfei
*@return void
*@throws
*导出图片详情
*/
public void ImgWordDetail() throws Throwable{
init();
//模版文件路径
String path = "/"+request.getSession().getServletContext().getRealPath("").replace("\", "/") + "/template/word/";
//导出名称
String fileName = "XXX.doc";
//模版文件,可用office生成
String templateName = "XXX.ftl";
Map dataMap = new HashMap();
//将查出来的数据封装到map
dataMap.put("gender", "男");
dataMap.put("military", "小兵");
...................................................
//调用下面方法
ExportWordByFreemarker.sendToBrowser(path, fileName, templateName, dataMap, response);

}

import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URLEncoder;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

public class ExportWordByFreemarker{

public static void sendToBrowser(String path, String fileName, String templateName, Map<String, String> map, HttpServletResponse response)
{
    Configuration configuration = new Configuration();
    configuration.setObjectWrapper(new DefaultObjectWrapper());
    configuration.setDefaultEncoding("utf-8");
    try {
        configuration.setDirectoryForTemplateLoading(new File(path));
    } catch (Exception e) {
        e.printStackTrace();
    }
    OutputStream outStream = null;
    Writer out = null;
    try {
        Template t = configuration.getTemplate(templateName, "utf-8");
        outStream = response.getOutputStream();
        out = new BufferedWriter(new OutputStreamWriter(outStream, "utf-8"), 10240);
        response.setContentType("application/msword");
        response.addHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
        response.setCharacterEncoding("utf-8");
        t.process(map, out);
    } catch (Exception e) {
        e.printStackTrace();
    }
    finally
    {
        if (outStream != null) {
            try {
                outStream.flush();
                outStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (out != null) {
            try {
                out.flush();
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

}

第一次回答问题,嘻嘻