参考代码
Dim tm As String = ProjectPath & "Attachments\依次打例子.doc" '指定模板文件
Dim fl As String = ProjectPath & "Reports\依次打例子.doc" '指定目标文件
Dim wrt As New WordReport(Tables("表A"),tm,fl) '定义一个WordReport
For i As Integer = Tables("表A").TopPosition To Tables("表A").BottomPosition
wrt.Replace("[姓名" & i-Tables("表A").TopPosition+1 & "]", Tables("表A").Rows(i)("姓名"))
wrt.ReplaceWithImage("[图片" & i-Tables("表A").TopPosition+1 & "]", ProjectPath & "Attachments/" & Tables("表A").Rows(i)("图片").trim(chr(10)).split(chr(13))(0),100,75)
Next
wrt.Build() '生成报表
wrt.Show() '显示报表
ReplaceWithImage |
方法,将指定的内容替换为图片,语法:
ReplaceWithImage(findstr,imagefile,width,height)
findstr: 字符型,指定要查找的内容 imgefile:字符型,用于替换的图片文件 width: 整数型,指定图片宽度 height:整数型,指定图片高度 |
[此贴子已经被作者于2015/6/11 14:39:36编辑过]