diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java index fb5d015a..b8d9b912 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java @@ -46,6 +46,7 @@ import com.sini.com.spire.doc.fields.TextRange; import com.sini.com.spire.doc.formatting.CharacterFormat; import com.sini.com.spire.doc.formatting.ParagraphFormat; import com.sini.com.spire.doc.formatting.RowFormat; +import com.sini.com.spire.doc.interfaces.IParagraph; import com.sini.com.spire.doc.interfaces.ITextRange; import freemarker.template.Configuration; import freemarker.template.Template; @@ -701,19 +702,14 @@ public class OutputWordUtil { System.out.println("HEADERFONT = " + text); cell.getParagraphs().get(0).setText(dataMap.getString("HEADERFONT")); //页眉logo - TableCell cellImg = table.getRows().get(0).getCells().get(1); - //创建 DocPicture 类的对象 - DocPicture picture = new DocPicture(templateDoc); - String logoUrl = dataMap.getString("LOGOURL"); - picture.loadImage(logoUrl); - //设置图片大小 - picture.setWidth(75); - picture.setHeight(90); - //将图片文本环绕方式设置为四周环绕 - picture.setTextWrappingStyle(TextWrappingStyle.Square); - //将图片插入到第二段 - cellImg.getChildObjects().insert(0,picture); + TableCell cellImg = table.getRows().get(0).getCells().get(1); + IParagraph firstParagraph = cellImg.getFirstParagraph(); + //进行替换 + firstParagraph.getChildObjects().removeAt(0); + DocPicture picture = firstParagraph.appendPicture(logoUrl); + picture.setWidth(44); + picture.setHeight(35); } DocumentObject obj = sourceHeader.getChildObjects().get(j).deepClone(); targetHeader.getChildObjects().add(obj);