循环给word插入图片
<#if image??>
<#list image as bean>
<w:p>
<w:pPr>
<w:ind w:first-line="420" w:first-line-chars="0"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN"/>
</w:rPr>
<w:pict>
<w:binData w:name="${" wordml://0200000"+bean.im_index+".png"}" xml:space="preserve">
${bean.image1}
</w:binData>
<v:shape id="_x0000_s1026" o:spt="75" alt="img" type="#_x0000_t75" style="width:450.25pt;" filled="f" o:preferrelative="t" stroked="f" coordsize="21600,21600">
<v:path/>
<v:fill on="f" focussize="0,0"/>
<v:stroke on="f"/>
<v:imagedata src="${" wordml://0200000"+bean.im_index+".png"}" o:title="img"/>
<o:lock v:ext="edit" aspectratio="t"/>
<w10:wrap type="none"/>
<w10:anchorlock/>
</v:shape>
</w:pict>
</w:r>
</w:p>
</#list>
</#if>
这段代码展示了如何使用Freemarker模板语言在Word文档中循环插入图片。每张图片的数据来源于一个名为`image`的列表,通过`<#list image as bean>`遍历。图片的属性如`bean.im_index`和`bean.image1`用于构造图片的路径和内容。模板还包含了图片的样式设置,如对齐方式、宽度等。
826

被折叠的 条评论
为什么被折叠?



