|
#1
|
|||
|
|||
Aligning Images Equally
I have MS Word on a Mac.
I have a Word document with a table in it. On one of the rows, I have about 5 images. But they are not spaced equally from each other. Is there a quick way to make them all equidistant from each other, even if its with VBA? JH |
#2
|
||||
|
||||
Are the images placed inline or are they floating?
I would say, make sure all are placed inline and have a space between each one and a soft return at the end. Then apply the paragraph alignment 'justify' (align left and right edges) to the paragraph they are sitting in. If the spacing doesn't 'appear' to be equal then check the white space around each graphic.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
I have it inline. The document is sent to me from my work so I can't change the layout. I get the document with the images in a line but not equally spaced. I cant press enter after each one otherwise it would create another line. Because I have hundreds of these types of rows to deal with, I'm looking for an easy way to make them equidistant all in one go. Any ideas for that? JH |
#4
|
||||
|
||||
You asked how to change the layout and then said you can't change the layout - do you expect the fix to do anything or nothing?
I said put one space between graphics on each line. You can do that with a search and replace to do it all in one go. Find: ^g Replace with: ^&[space] Then add a soft return in front of each paragraph mark. Which can also be done with find and replace.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
The current spaces are random so if I add a space between each one they will still be non-equidistant. |
#6
|
|||
|
|||
Ideally, instead of all being in the same row, there'd be five columns, with one picture in each cell.
But barring that, to me the easiest thing would be to change all the images from wrapping "in line with text" to "Square" or something else. Then you can select all the images in the row and use the Align tools to Distribute Horizontally. That works for one row, but if you want row after row to also line up vertically, again, you'd be better off breaking your rows into columns so you have an even grid. You could do that and make the internal column borders non-printing. Another possibility - if you have to leave them in line with text, add a wide white border around each image which should provide the same space left and right on each image. You'll also have that white space top and bottom as well. When I inserted five pictures in one row, and resized them, the in line with text option seemed to automatically butt them up tightly against each other. I'm surprised yours didn't do that? |
#7
|
|||
|
|||
Thanks for that. I'm going to try out your suggestions.
I get this document every day from my workplace and its already set like this. I can't make any changes except to clean it up a bit. So I can't add any columns to the table. I'll see if that square method works. Thanks, JH |
#8
|
|||
|
|||
Just tried that, and I cant really select all images in one go to change the wrapping. It will only allow me to select one image.
Also, the Distribute option does not appear if I run my mouse over all the images and select them that way. |
#9
|
||||
|
||||
You need to post a sample document, not a screenshot of it.
Based on the screenshot, it appears that you are looking at white borders that are part of the photos, not spaces in between the photos. In that case you would need to crop the images to remove the 'white' areas. And the second row image is not going to align with the image above if they are different widths.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#10
|
|||
|
|||
They are definitely spaces in between but some are 5 spaces, some 2 and some 3 etc...
I have to manually insert the cursor there and press space or delete to line them up. The row is part of a whole table. And I have multiple tables with similar images in the document. So I'm wondering if I can maybe use a Macro to just space them evenly between each other with 2 spaces. Dont need the upper row aligned with the images on the bottom row. Just need each row equidistant between its own pictures. JH |
#11
|
||||
|
||||
You still haven't provided a sample doc so I'm not bothering with creating a macro to deal with an undefined problem.
Your screenshot shows a different colour between the graphics than the rest of the table background. Make all the non-printing characters visible and show us another screenshot so we can see what is actually between the graphics.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#13
|
||||
|
||||
Try this macro
Code:
Sub SpaceBalls() Dim aRng As Range, aSty As Style Set aRng = ActiveDocument.Content Set aSty = ActiveDocument.Styles(wdStyleHtmlPre) aSty.ParagraphFormat.Alignment = wdAlignParagraphDistribute With aRng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^g" .Replacement.Text = "^& " .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = False .Execute Replace:=wdReplaceAll .Text = "[ ]{2,}" .Replacement.Text = " " .MatchWildcards = True .Execute Replace:=wdReplaceAll .Format = True .Text = "^g" .Replacement.Text = "^&" .MatchWildcards = False .Replacement.Style = aSty .Execute Replace:=wdReplaceAll End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#14
|
|||
|
|||
Thanks a lot for this. Much appreciated.
My company doesn't like to spread the images across the whole row. They would like me to place the images with 1 or 2 spaces in between each image, starting from the left. Can this code be modified to do that? Really appreciate this effort. JH |
#15
|
||||
|
||||
To standardise on one space
Code:
Sub SpaceBallsOneSpace() Dim aRng As Range, aSty As Style Set aRng = ActiveDocument.Content With aRng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^g" .Replacement.Text = "^& " .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = False .Execute Replace:=wdReplaceAll .Text = "[ ]{2,}" .Replacement.Text = " " .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Opening all selected images, resizing images and placing them into a table. | John Livewire | Word VBA | 1 | 09-15-2017 11:24 PM |
How do I make all text in word equally lined? | MRnightmuffin | Word | 2 | 08-21-2017 03:21 PM |
Distribute shapes equally | Losey | Visio | 2 | 11-18-2014 01:29 PM |
Equally allocate/assign across resouces | chconnors | Project | 1 | 06-01-2011 03:27 AM |
Mail Mege Images - Path Correct but Images Repeated | Sonia Sosa | Mail Merge | 8 | 04-22-2011 03:05 PM |