想要循环数据,生成不单元格内换行的操作,如下
1:如果看到这 那应该知道怎么把doc文件转化为.xml文件,并格式化.xml文件(格式化工具,https://tool.oschina.net/codeformat/xml/),打开文件建议用Notepad++(因为有颜色区分,非常方便)
2:最好直接在模板中就有换行符,这样的话就避免单元格内换行的问题
找准插入list的位置
<#list phshList as phsh>
...
<w:t><#if phsh.pihao??>${phsh.pihao}</#if></w:t>
...
</#list>
<w:tc>
<w:tcPr>
<w:tcW w:w="4260" w:type="dxa"/>
<w:gridSpan w:val="2"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<#list phshList as phsh>
<w:p w:rsidR="009C1DEF" w:rsidRPr="00894917" w:rsidRDefault="00B72524" w:rsidP="00894917">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="仿宋" w:eastAsia="仿宋" w:hAnsi="仿宋"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
</w:rPr>
</w:pPr>
<w:proofErr w:type="spellStart"/>
<w:r>
<w:rPr>
<w:rFonts w:ascii="仿宋" w:eastAsia="仿宋" w:hAnsi="仿宋" w:hint="eastAsia"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
</w:rPr>
<w:t><#if phsh.pihao??>${phsh.pihao}</#if></w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
</w:p>
</#list>
</w:tc>