项目库-删除: 关联删除收集清单
This commit is contained in:
+27
-2
@@ -125,12 +125,12 @@ public class Docx4jUtil {
|
||||
Map<String, Object> picMap1 = new HashMap<>();
|
||||
picMap1.put("key", "NIO-005");
|
||||
picMap1.put("text", "XXXXX");
|
||||
picMap1.put("bytes", WordUtils.inputStream2ByteArray(new FileInputStream("D:\\text\\png1.png"), true));
|
||||
picMap1.put("bytes", inputStream2ByteArray(new FileInputStream("D:\\text\\png1.png"), true));
|
||||
|
||||
Map<String, Object> picMap2 = new HashMap<>();
|
||||
picMap2.put("key", "NIO-007");
|
||||
picMap2.put("text", "wok#wwokwo");
|
||||
picMap2.put("bytes", WordUtils.inputStream2ByteArray(new FileInputStream("D:\\text\\jpg2.jpg"), true));
|
||||
picMap2.put("bytes", inputStream2ByteArray(new FileInputStream("D:\\text\\jpg2.jpg"), true));
|
||||
|
||||
picList.add(picMap1);
|
||||
picList.add(picMap2);
|
||||
@@ -144,6 +144,31 @@ public class Docx4jUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将输入流中的数据写入字节数组
|
||||
* @param in
|
||||
* @return
|
||||
*/
|
||||
public static byte[] inputStream2ByteArray(InputStream in, boolean isClose) {
|
||||
byte[] byteArray = null;
|
||||
try {
|
||||
int total = in.available();
|
||||
byteArray = new byte[total];
|
||||
in.read(byteArray);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (isClose) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception e2) {
|
||||
e2.getStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public static Builder Builder;
|
||||
|
||||
public static Builder of(String path) throws FileNotFoundException, Docx4JException {
|
||||
|
||||
Reference in New Issue
Block a user