How can I to scale down or to scale up proportionally dimension ofpictures?

A

avkokin

Hello. The document has a lot of the formulas (as pictures). The
formulas has different dimensions: very big, normal and small. I need
to reduce they to some equal dimension (to reduce to common
denominator). I have code but the result of work not suit for me: e.g.
the text into the big formulas converges and other problems. Here the
code:
Sub changeImages()
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
iShape.Height = 17
iShape.Width = 138
Next iShape
End Sub
How to scale down or to scale up proportionally dimensions of the all
formulas (pictures)?
Thank you.
 
J

Jean-Guy Marcil

avkokin said:
Hello. The document has a lot of the formulas (as pictures). The
formulas has different dimensions: very big, normal and small. I need
to reduce they to some equal dimension (to reduce to common
denominator). I have code but the result of work not suit for me: e.g.
the text into the big formulas converges and other problems. Here the

If you change the size of those equations so that they all have the same
size (Height and Width), you will have distortion problems and you cannot
avoid that.

If you want, you can reduce all inline shapes by a certain ratio based on
the shape width, then you would use something like this:

Sub changeImages()

Dim iShape As InlineShape
Const sngWidth As Single = 150

For Each iShape In ActiveDocument.InlineShapes
With iShape
.ScaleHeight = (.Width / sngWidth) * 100
.ScaleWidth = (.Width / sngWidth) * 100
End With
Next iShape

End Sub


Alternatively, if you want to reduce all shapes by an absolute percentage,
let's say, 50%, try:

Sub changeImages()

Dim iShape As InlineShape

For Each iShape In ActiveDocument.InlineShapes
With iShape
.ScaleHeight = 50
.ScaleWidth = 50
End With
Next iShape

End Sub

If you want to set them all to the same size while trying to avoid
distortion, try this:


Sub changeImages()

Dim iShape As InlineShape
Const sngWidth As Single = 72 '72 points = 1 inche

For Each iShape In ActiveDocument.InlineShapes
With iShape
.Height = .Height * (sngWidth / .Width)
.Width = sngWidth
End With
Next iShape

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top