用freemarker生成word时怎么样插入多张图片

J2EE 码拜 8年前 (2016-09-10) 1306次浏览
用freemarker插入一张图片已经实现,现在要插入多张图片有问题,网上找的这个方法没用,来个高手,最好有完整的已经实现的例子
<#list images as im>
<w:pict>
<v:shapetype id=”_x0000_t75″ coordsize=”21600,21600″ o:spt=”75″ o:preferrelative=”t” path=”m@4@5l@4@11@9@11@9@5xe” filled=”f” stroked=”f”>
<v:stroke joinstyle=”miter”/>
<v:formulas>
<v:f eqn=”if lineDrawn pixelLineWidth 0″/>
<v:f eqn=”sum @0 1 0″/>
<v:f eqn=”sum 0 0 @1″/>
<v:f eqn=”prod @2 1 2″/>
<v:f eqn=”prod @3 21600 pixelWidth”/>
<v:f eqn=”prod @3 21600 pixelHeight”/>
<v:f eqn=”sum @0 0 1″/>
<v:f eqn=”prod @6 1 2″/>
<v:f eqn=”prod @7 21600 pixelWidth”/>
<v:f eqn=”sum @8 21600 0″/>
<v:f eqn=”prod @7 21600 pixelHeight”/>
<v:f eqn=”sum @10 21600 0″/>
</v:formulas>
<v:path o:extrusionok=”f” gradientshapeok=”t” o:connecttype=”rect”/>
<o:lock v:ext=”edit” aspectratio=”t”/>
</v:shapetype>
<w:binData w:name=”${“wordml://0200000″+im_index+1+”.jpg”}” xml:space=”preserve”>${im}</w:binData>
<v:shape id=”图片” o:spid=”_x0000_i1025″ type=”#_x0000_t75″ style=”width:414.75pt;height:207.75pt;visibility:visible;mso-wrap-style:square”>
<v:imagedata src=”${“wordml://0200000″+im_index+1+”.jpg”}” o:title=”菜单”/>
</v:shape>
</w:pict>
</#list>
解决方案

50

题主怎么解决的?为什么本人插入图片地方的代码和你的不同?

<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="5274310" cy="1554540"/>
<wp:effectExtent l="0" t="0" r="2540" b="7620"/>
<wp:docPr id="3" name="图片 3" descr="D:\PDF\word\team\pics\团体0.jpeg"/>
<wp:cNvGraphicFramePr>
<a:graphicFrameLocks noChangeAspect="1" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/>
</wp:cNvGraphicFramePr>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="0" name="Picture 1" descr="D:\PDF\word\team\pics\团体0.jpeg"/>
<pic:cNvPicPr>
<a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>
</pic:cNvPicPr>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId6">
<a:extLst>
<a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
<a14:useLocalDpi val="0" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"/>
</a:ext>
</a:extLst>
</a:blip>
<a:srcRect/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr bwMode="auto">
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="5274310" cy="1554540"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
<a:noFill/>
<a:ln>
<a:noFill/>
</a:ln>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>

本人的是这个样子的。本人可以循环插入图片,但出现一个问题,由于本人插入的图片尺寸大小不一样,导致出来的图片有很多变形了


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明用freemarker生成word时怎么样插入多张图片
喜欢 (0)
[1034331897@qq.com]
分享 (0)