|
@@ -20,6 +20,7 @@ import javax.servlet.ServletOutputStream;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
+import org.apache.commons.lang.StringEscapeUtils;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
import cn.com.qmth.examcloud.commons.util.UUID;
|
|
import cn.com.qmth.examcloud.commons.util.UUID;
|
|
@@ -158,11 +159,12 @@ public class ExcelExportUtil {
|
|
cell.setR(colName.get(i)+index);
|
|
cell.setR(colName.get(i)+index);
|
|
cell.setS("0");
|
|
cell.setS("0");
|
|
if(value!=null) {
|
|
if(value!=null) {
|
|
- Integer cellV=vmap.get(value.toString());
|
|
|
|
|
|
+ String encodeValue=StringEscapeUtils.escapeXml(value.toString());
|
|
|
|
+ Integer cellV=vmap.get(encodeValue);
|
|
if(cellV==null) {
|
|
if(cellV==null) {
|
|
vmapSize++;
|
|
vmapSize++;
|
|
cellV=vmapSize;
|
|
cellV=vmapSize;
|
|
- vmap.put(value.toString(), cellV);
|
|
|
|
|
|
+ vmap.put(encodeValue, cellV);
|
|
}
|
|
}
|
|
cell.setV(cellV.toString());
|
|
cell.setV(cellV.toString());
|
|
}else {
|
|
}else {
|
|
@@ -296,7 +298,7 @@ public class ExcelExportUtil {
|
|
for(Method method : methods){
|
|
for(Method method : methods){
|
|
ExcelProperty exportProperty = method.getAnnotation(ExcelProperty.class);
|
|
ExcelProperty exportProperty = method.getAnnotation(ExcelProperty.class);
|
|
if(exportProperty != null && exportProperty.name().trim().length() > 0){
|
|
if(exportProperty != null && exportProperty.name().trim().length() > 0){
|
|
- ColumnSetting columnSetting = new ColumnSetting(exportProperty.name(),method.getName(),
|
|
|
|
|
|
+ ColumnSetting columnSetting = new ColumnSetting(StringEscapeUtils.escapeXml(exportProperty.name()),method.getName(),
|
|
exportProperty.width(),exportProperty.index());
|
|
exportProperty.width(),exportProperty.index());
|
|
columnSettings.add(columnSetting);
|
|
columnSettings.add(columnSetting);
|
|
}
|
|
}
|
|
@@ -307,7 +309,7 @@ public class ExcelExportUtil {
|
|
for(Field field:fields){
|
|
for(Field field:fields){
|
|
ExcelProperty exportProperty = field.getAnnotation(ExcelProperty.class);
|
|
ExcelProperty exportProperty = field.getAnnotation(ExcelProperty.class);
|
|
if(exportProperty != null && exportProperty.name().trim().length() > 0){
|
|
if(exportProperty != null && exportProperty.name().trim().length() > 0){
|
|
- ColumnSetting columnSetting = new ColumnSetting(exportProperty.name(),"get"+toUpperCaseFirstOne(field.getName()),
|
|
|
|
|
|
+ ColumnSetting columnSetting = new ColumnSetting(StringEscapeUtils.escapeXml(exportProperty.name()),"get"+toUpperCaseFirstOne(field.getName()),
|
|
exportProperty.width(),exportProperty.index());
|
|
exportProperty.width(),exportProperty.index());
|
|
columnSettings.add(columnSetting);
|
|
columnSettings.add(columnSetting);
|
|
}
|
|
}
|