标题:
[文本处理]
让word文档中的图片适配页面大小
[打印本页]
作者:
想尽办法摸鱼
时间:
2022-8-4 11:17
标题:
让word文档中的图片适配页面大小
现在的word文档有200页,每一页都插入了一张照片,怎样批处理设置可以把所有照片适配文档的页面尺寸,完整显示整张图片?
作者:
hfxiang
时间:
2022-8-4 12:11
Sub 图片锁定纵横比自适应页宽()
'
' 图片锁定纵横比自适应页宽 宏
'
'
Dim shap As InlineShape
Dim maxWith
maxWith = ActiveDocument.PageSetup.PageWidth - ActiveDocument.PageSetup.LeftMargin - ActiveDocument.PageSetup.RightMargin '宽度自适应
For Each shap In ActiveDocument.InlineShapes
Debug.Print shap.Type; "Shap.Type"; wdInlineShapePicture
If (shap.Type = wdInlineShapeLinkedPicture) Or (shap.Type = wdInlineShapePicture) Then
'If shap.Width > maxWith Then
'Shap.LockAspectRatio = msoTrue
Debug.Print "before width: "; shap.Width
Debug.Print "before Height: "; shap.Height
oW = shap.Width
oH = shap.Height
aspect = oH / oW 'aspect ratio
shap.Width = maxWith
shap.Height = aspect * maxWith
Debug.Print "after width: "; shap.Width
Debug.Print "after Height: "; shap.Height
'End If
End If
Next
End Sub
欢迎光临 批处理之家 (http://www.bathome.net/)
Powered by Discuz! 7.2