Commit 435f2db211316b840a6055a9a12cb1ef94e5d9d9
1 parent
c711a0fed7
Exists in
master
and in
6 other branches
导出
Showing 3 changed files with 33 additions and 27 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
View file @
435f2db
... | ... | @@ -4,10 +4,7 @@ |
4 | 4 | import java.util.*; |
5 | 5 | |
6 | 6 | |
7 | -import jxl.Cell; | |
8 | -import jxl.Range; | |
9 | -import jxl.Sheet; | |
10 | -import jxl.Workbook; | |
7 | +import jxl.*; | |
11 | 8 | import jxl.format.*; |
12 | 9 | import jxl.format.Alignment; |
13 | 10 | import jxl.format.Colour; |
... | ... | @@ -241,8 +238,9 @@ |
241 | 238 | try { |
242 | 239 | in = new FileInputStream(file); |
243 | 240 | wb = Workbook.getWorkbook(in); |
244 | - | |
245 | - WritableWorkbook book = wb.createWorkbook(out,wb); | |
241 | + WorkbookSettings settings = new WorkbookSettings (); | |
242 | + settings.setWriteAccess(null); | |
243 | + WritableWorkbook book = wb.createWorkbook(out,wb,settings); | |
246 | 244 | WritableSheet ws = book.getSheet(0); |
247 | 245 | |
248 | 246 | WritableFont contentFont = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); |
249 | 247 | |
250 | 248 | |
251 | 249 | |
... | ... | @@ -255,26 +253,33 @@ |
255 | 253 | for (int i = 2, len = values.size()+2; i < len; i++, arrayIndex++) |
256 | 254 | { |
257 | 255 | |
258 | - Set<String> sets = values.get(arrayIndex).keySet(); | |
259 | - int j = 0; | |
260 | - for (String key : sets) | |
261 | - { | |
262 | - String value = values.get(arrayIndex).get(key)+""; | |
263 | - if (StringUtils.isNotEmpty(value) && StringUtils.isNum(value)) | |
256 | + try { | |
257 | + Set<String> sets = values.get(arrayIndex).keySet(); | |
258 | + int j = 0; | |
259 | + for (String key : sets) | |
264 | 260 | { |
265 | - WritableCellFormat wcfN = new WritableCellFormat(contentFont); | |
266 | - wcfN.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
267 | - wcfN.setAlignment(jxl.format.Alignment.CENTRE); | |
268 | - wcfN.setVerticalAlignment(VerticalAlignment.CENTRE); | |
269 | - Number labelNF = new Number(j, i,Integer.parseInt(value), wcfN); | |
270 | - ws.addCell(labelNF); | |
261 | + String value = values.get(arrayIndex).get(key)+""; | |
262 | + if (StringUtils.isNotEmpty(value) && StringUtils.isNum(value)) | |
263 | + { | |
264 | + WritableCellFormat wcfN = new WritableCellFormat(contentFont); | |
265 | + wcfN.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
266 | + wcfN.setAlignment(jxl.format.Alignment.CENTRE); | |
267 | + wcfN.setVerticalAlignment(VerticalAlignment.CENTRE); | |
268 | + Number labelNF = new Number(j, i,Integer.parseInt(value), wcfN); | |
269 | + ws.addCell(labelNF); | |
270 | + } | |
271 | + else | |
272 | + { | |
273 | + ws.addCell(new Label(j, i,value, contentFormt)); | |
274 | + } | |
275 | + j++; | |
271 | 276 | } |
272 | - else | |
273 | - { | |
274 | - ws.addCell(new Label(j, i,value, contentFormt)); | |
275 | - } | |
276 | - j++; | |
277 | 277 | } |
278 | + catch (Exception e) | |
279 | + { | |
280 | + continue; | |
281 | + } | |
282 | + | |
278 | 283 | } |
279 | 284 | |
280 | 285 | book.write(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
435f2db
... | ... | @@ -2860,12 +2860,13 @@ |
2860 | 2860 | String tpSize = ""; |
2861 | 2861 | if (temp.getTpSize() != null && temp.getTpSize().size() > 0) { |
2862 | 2862 | tpSize += temp.getTpSize().get("c") + UnitConstants.CM + "*" + temp.getTpSize().get("k") + UnitConstants.CM + "*" + temp.getTpSize().get("g") + UnitConstants.CM; |
2863 | + sizeMap.put("c",temp.getTpSize().get("c")); | |
2864 | + sizeMap.put("k",temp.getTpSize().get("k")); | |
2865 | + sizeMap.put("g",temp.getTpSize().get("g")); | |
2866 | + extMap.put("tpSizeList",sizeMap); | |
2863 | 2867 | } |
2864 | 2868 | extMap.put("tpSize", tpSize); |
2865 | - sizeMap.put("c",temp.getTpSize().get("c")); | |
2866 | - sizeMap.put("k",temp.getTpSize().get("k")); | |
2867 | - sizeMap.put("g",temp.getTpSize().get("g")); | |
2868 | - extMap.put("tpSizeList",sizeMap); | |
2869 | + | |
2869 | 2870 | extMap.put("tpWeight", UnitUtils.unitSplice(temp.getTpWeight(), UnitConstants.G)); |
2870 | 2871 | extMap.put("umbilicalCordLength", UnitUtils.unitSplice(temp.getUmbilicalCordLength(), UnitConstants.CM)); |
2871 | 2872 |
platform-operate-api/src/main/resources/fm_record.xls
View file @
435f2db