|
|
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.spire.doc.Document;
|
|
|
|
|
import com.spire.doc.FileFormat;
|
|
|
|
|
import com.spire.doc.PageSetup;
|
|
|
|
|
import com.spire.doc.Section;
|
|
|
|
|
import com.spire.doc.documents.HorizontalAlignment;
|
|
|
|
|
import com.spire.doc.documents.Paragraph;
|
|
|
|
@ -552,34 +553,61 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
|
|
|
|
|
paragraph1.applyStyle("paraStyle");
|
|
|
|
|
Paragraph paragraph = section.addParagraph();
|
|
|
|
|
File filePath = new File((String) map1.get("filePath"));
|
|
|
|
|
DocPicture pic =null;
|
|
|
|
|
DocPicture picture =null;
|
|
|
|
|
if (filePath.exists()){
|
|
|
|
|
pic = paragraph.appendPicture((String) map1.get("filePath"));
|
|
|
|
|
int picHeight = 600;
|
|
|
|
|
int picWidth = 500;
|
|
|
|
|
Integer width = null;
|
|
|
|
|
Integer height = null;
|
|
|
|
|
picture = paragraph.appendPicture((String) map1.get("filePath"));
|
|
|
|
|
// int picHeight = 600;
|
|
|
|
|
// int picWidth = 500;
|
|
|
|
|
// Integer width = null;
|
|
|
|
|
// Integer height = null;
|
|
|
|
|
// if (map1.get("width") != null) {
|
|
|
|
|
// width = Integer.valueOf(String.valueOf(map1.get("width")));
|
|
|
|
|
// }
|
|
|
|
|
// if (map1.get("height") != null) {
|
|
|
|
|
// height = Integer.valueOf(String.valueOf(map1.get("height")));
|
|
|
|
|
// }
|
|
|
|
|
// if (width != null && height != null) {
|
|
|
|
|
// if (height>picHeight){
|
|
|
|
|
// picHeight = picWidth * (height/width) ;
|
|
|
|
|
// }else {
|
|
|
|
|
// picHeight=height;
|
|
|
|
|
// }
|
|
|
|
|
// if (width>picWidth){
|
|
|
|
|
// picHeight = picWidth * (height/width) ;
|
|
|
|
|
// }else {
|
|
|
|
|
// picWidth=width;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Section sectionn = document.getLastSection();
|
|
|
|
|
PageSetup pageSetup = sectionn.getPageSetup();
|
|
|
|
|
//获取页面宽度
|
|
|
|
|
float pageWidth = (float)pageSetup.getPageSize().getWidth();
|
|
|
|
|
//获取左右页边距宽度
|
|
|
|
|
float left = pageSetup.getMargins().getLeft();
|
|
|
|
|
float right = pageSetup.getMargins().getRight();
|
|
|
|
|
//可编辑区域的宽度,此宽度既可以作为插入图片的宽度,刚好铺满
|
|
|
|
|
float width = pageWidth - left - right;
|
|
|
|
|
|
|
|
|
|
//设置图片大小代码
|
|
|
|
|
|
|
|
|
|
picture.setWidth(width );
|
|
|
|
|
Integer height = 0;
|
|
|
|
|
Integer widthh = 0;
|
|
|
|
|
if (map1.get("width") != null) {
|
|
|
|
|
width = Integer.valueOf(String.valueOf(map1.get("width")));
|
|
|
|
|
widthh = Integer.valueOf(String.valueOf(map1.get("width")));
|
|
|
|
|
}
|
|
|
|
|
if (map1.get("height") != null) {
|
|
|
|
|
height = Integer.valueOf(String.valueOf(map1.get("height")));
|
|
|
|
|
}
|
|
|
|
|
if (width != null && height != null) {
|
|
|
|
|
if (height>picHeight){
|
|
|
|
|
picHeight = picWidth * (height/width) ;
|
|
|
|
|
}else {
|
|
|
|
|
picHeight=height;
|
|
|
|
|
}
|
|
|
|
|
if (width>picWidth){
|
|
|
|
|
picHeight = picWidth * (height/width) ;
|
|
|
|
|
}else {
|
|
|
|
|
picWidth=width;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pic.setWidth(picWidth==0?500:picWidth);
|
|
|
|
|
pic.setHeight(picHeight==0?600:picHeight);
|
|
|
|
|
picture.setHeight(widthh!=0?width*(height/widthh):0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// picture.setWidth(picWidth==0?500:picWidth);
|
|
|
|
|
// picture.setHeight(picHeight==0?600:picHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|