老师,因为图片是附在文字上方的,还有是在侧边的位置,这个模板看不懂怎么操作,麻烦老师看下怎么改下面的代码
Dim fl As String = ProjectPath & "1.docx"
Dim yz As String = ProjectPath & "y2.png"
'请问老师如何获取doc的全部页数pages?
'根据页数分解骑缝章
Dim img = getimage(yz)
Dim pages As Integer = 3
Dim page As Integer = 2
Dim imgw As Integer = img.width / pages
For i As Integer = 1 To pages
Dim bmp As new bitmap(imgw, img.height) '宽高
Dim g = graphics.fromimage(bmp)
Dim x As Integer = (i-1)*imgw '开始坐标
Dim y As Integer = 0 '开始坐标
Dim w As Integer = bmp.width
Dim h As Integer = bmp.height
g.DrawImage(img, new Rectangle(0, 0, w, h), new Rectangle(x, y, w, h), GraphicsUnit.Pixel)
bmp.save(ProjectPath & "骑缝章\" & i & ".png")
bmp.dispose
Next
Dim App As New MSWord.Application
Dim doc As object = app.Documents.Open(fl)
'第一页跟最后一页都要插入完整的印章,这个如何修改?
Dim s = doc.Shapes.AddPicture(yz, False, True,60, 425, 110, 110)
s.WrapFormat.Type = MSWord.WdWrapType.wdWrapFront
'每一页都要贴上骑缝章,这个如何修改
Dim s2 = doc.Shapes.AddPicture(ProjectPath & "骑缝章\1.png", False, True,520, 250, 110/pages , 110)
s2.WrapFormat.Type = MSWord.WdWrapType.wdWrapFront
'Dim s3 = doc.Shapes.AddPicture(ProjectPath & "骑缝章\2.png", False, True,520, 250, 110/pages , 110)
's3.WrapFormat.Type = MSWord.WdWrapType.wdWrapFront
'Dim s4 = doc.Shapes.AddPicture(ProjectPath & "骑缝章\3.png", False, True,520, 250, 110/pages , 110)
's4.WrapFormat.Type = MSWord.WdWrapType.wdWrapFront
app.visible = True
[此贴子已经被作者于2022/1/17 9:20:22编辑过]