我使用了JAVA 1.7,Gxt和Oracle 11g以及MyBatis。
到目前为止,我用jxsl做了这个。
XML
<beans>
<bean id="excelViewByJXLS" class="com.test.UserExcelView">
<property name="contentType" value="application/vnd.ms-excel; charset=UTF-8"></property>
</bean>
</beans>
的java
public class UserExcelView extends AbstractExcelView {
@Override
protected void buildExcelDocument(Map<String, Object> model,
HSSFWorkbook workbook, HttpServletRequest request,
HttpServletResponse response) throws Exception {
XLSTransformer transformer = new XLSTransformer();
String templateFileName = "templateFileName";
String destFileName = "destFileName";
Workbook resultWorkbook = transformer.transformXLS(new FileInputStream(templateFileName), model);
StringBuffer contentDisposition = new StringBuffer();
contentDisposition.append("attachment;fileName=\"");
contentDisposition.append(destFileName);
contentDisposition.append("\";");
response.setHeader("Content-Disposition", contentDisposition.toString());
response.setContentType("application/x-msexcel");
resultWorkbook.write(response.getOutputStream());
}
}
但是,我无法上传和输入。
我想使用jxsl上传和更新到数据库中。