Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2014, 12:54 PM
garybeck garybeck is offline Issue with figure captions (word 2010) Windows 7 64bit Issue with figure captions (word 2010) Office 2010 64bit
Novice
Issue with figure captions (word 2010)
 
Join Date: Aug 2014
Posts: 13
garybeck is on a distinguished road
Default Issue with figure captions (word 2010)

This is strange.



I have a bunch of figures in my document. I am creating captions for them. I select the image, click "insert caption" and follow the instructions.

Sometimes when I do this, the caption appears as a line of text within the regular text flow, above the image.

Sometimes when I do this, the caption appears inside a separate text box, that is isolated from the rest of the text, above the image.

When I want to create a cross reference to a figure, the list of figures that appears in the "create cross reference" dialog has two sections.... the ones that are inline text appear first, and then the ones that are in text boxes. So they are out of order.

Luckily this does not affect the List of Figures; the list is in the right order and does not pay attention to the two types of captions.

However, the two types of captions look different in the document. the ones in the text boxes are higher up above the figure.

I would like to understand why there are two types and make them all the same for consistency purposes.

I have tried a few things but nothing seems to work.

Does anyone have any idea why I'm getting the two types of captions and what I could do to make them all the same (I prefer the inline text type because it appears right above the figure).

Thank you.
Gary Beckwith
Technical Writer for IBM
Reply With Quote
  #2  
Old 08-15-2014, 03:18 PM
macropod's Avatar
macropod macropod is offline Issue with figure captions (word 2010) Windows 7 32bit Issue with figure captions (word 2010) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The difference in behaviour is related to the wrap format of the images. If they're in-line with text, Word is programmed to insert the captions that way too. If they're square, for example, Word is programmed to insert the captions into a textbox. IMHO, the latter is dumb, as there is no necessary connection between the caption and its image and the caption numbering becomes dependent on where the caption is anchored, and the anchor's order in the document, not on the anchor position of the image to which it relates. The treatment of inline images really isn't much better as it's all too easy to move the image without its caption.

The following macro embeds all images (i.e. Shapes & InlineShapes) in a document in tables with a row for Captions.
Code:
Sub AddImageCaptionTables()
Dim iShp As InlineShape, Rng As Range, Tbl As Table
Dim i As Long, PicWdth As Single, VPos As Single
Dim HPos As Single, VRel As Long, HRel As Long
With ActiveDocument
  For i = 1 To .InlineShapes.Count
    If .InlineShapes(i).Range.Information(wdWithInTable) = False Then
      PicWdth = .InlineShapes(i).Width
      Set Rng = .InlineShapes(i).Range
      With Rng
        If .Characters.Last.Next.Text = vbCr Then .Characters.Last.Next.Text = vbNullString
        .InlineShapes(1).Range.Cut
      End With
      'If you don't want a row for captioning etc, change the 2 in the next line to 1.
      Set Tbl = .Tables.Add(Range:=Rng, Numrows:=2, NumColumns:=1)
      With Tbl
        With .Cell(1, 1).Range.ParagraphFormat
          .SpaceBefore = 0
          .SpaceAfter = 0
          .LeftIndent = 0
          .RightIndent = 0
          .FirstLineIndent = 0
          .KeepWithNext = True
        End With
        .Cell(1, 1).Range.Paste
        'If you don't want to add captions, delete from here to 'End With'
        Set Rng = .Cell(2, 1).Range
        With Rng
          .Style = "Caption"
          .End = .End - 1
          .InsertAfter vbCr
          .InsertCaption Label:="Figure", TitleAutoText:=" ", Title:="", _
            Position:=wdCaptionPositionBelow, ExcludeLabel:=0
          .Characters.First.Text = vbNullString
          .Paragraphs.First.Range.Characters.Last.Text = vbNullString
        End With
        .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
        .Borders(wdBorderRight).LineStyle = wdLineStyleNone
        .Borders(wdBorderTop).LineStyle = wdLineStyleNone
        .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
        .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
        .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
        .TopPadding = 0
        .BottomPadding = 0
        .LeftPadding = 0
        .RightPadding = 0
        .Spacing = 0
        .Columns.Width = PicWdth
      End With
    End If
  Next
  While .Shapes.Count > 0
    With .Shapes(1)
      VRel = .RelativeVerticalPosition
      HRel = .RelativeHorizontalPosition
      VPos = .Top
      HPos = .Left
      PicWdth = .Width
      Set iShp = .ConvertToInlineShape
    End With
    With iShp
      Set Rng = .Range
      .Range.Cut
    End With
    'If you don't want a row for captioning etc, change the 2 in the next line to 1.
    Set Tbl = .Tables.Add(Range:=Rng, Numrows:=2, NumColumns:=1)
    With Tbl
      With .Rows
        .LeftIndent = 0
        .WrapAroundText = True
        .HorizontalPosition = HPos
        .RelativeHorizontalPosition = HRel
        .VerticalPosition = VPos
        .RelativeVerticalPosition = VRel
        .AllowOverlap = False
      End With
      With .Cell(1, 1).Range.ParagraphFormat
        .SpaceBefore = 0
        .SpaceAfter = 0
        .LeftIndent = 0
        .RightIndent = 0
        .FirstLineIndent = 0
        .KeepWithNext = True
      End With
      .Cell(1, 1).Range.Paste
      'If you don't want to add captions, delete from here to 'End With'
      Set Rng = .Cell(2, 1).Range
      With Rng
        .Style = "Caption"
        .End = .End - 1
        .InsertAfter vbCr
        .InsertCaption Label:="Figure", TitleAutoText:=" ", Title:="", _
          Position:=wdCaptionPositionBelow, ExcludeLabel:=0
        .Characters.First.Text = vbNullString
        .Paragraphs.First.Range.Characters.Last.Text = vbNullString
      End With
      .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
      .Borders(wdBorderRight).LineStyle = wdLineStyleNone
      .Borders(wdBorderTop).LineStyle = wdLineStyleNone
      .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
      .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
      .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
      .TopPadding = 0
      .BottomPadding = 0
      .LeftPadding = 0
      .RightPadding = 0
      .Spacing = 0
      .Columns.Width = PicWdth
    End With
  Wend
End With
End Sub
Note that, due to the extra space taken up by the caption row, all except for the first of the document's pictures are liable to shift position.

As coded, the macro inserts the caption row below its image If you want them to be above the images, swap the .Cell(1, 1) and .Cell(2, 1) references around (i.e. all .Cell(1, 1) references become .Cell(2, 1) and vice-versa).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-18-2014, 07:53 AM
garybeck garybeck is offline Issue with figure captions (word 2010) Windows 7 64bit Issue with figure captions (word 2010) Office 2010 64bit
Novice
Issue with figure captions (word 2010)
 
Join Date: Aug 2014
Posts: 13
garybeck is on a distinguished road
Default

thanks for the info!
so I prefer the in-line captions because they create less white space and that's how the majority of the ones in this document are set up.

I'm trying to convert the text box captions into in-line captions. Based on your info, if I change the format of the image to "inline" or "square" I should be able to control the type of caption that is created for it, correct?

it doesn't seem to be working. if I remove the caption, change the image format to inline, then make a new caption, it still shows up as a text box.

any suggestions?

thanks again
Reply With Quote
  #4  
Old 08-18-2014, 07:42 PM
macropod's Avatar
macropod macropod is offline Issue with figure captions (word 2010) Windows 7 32bit Issue with figure captions (word 2010) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If the images are in-line, right-clicking on them and choosing Insert Caption gives you the option of inserting it above or below the image. In either case, it's inserted into a normal paragraph (with the Caption Style applied)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 08-19-2014, 08:55 AM
garybeck garybeck is offline Issue with figure captions (word 2010) Windows 7 64bit Issue with figure captions (word 2010) Office 2010 64bit
Novice
Issue with figure captions (word 2010)
 
Join Date: Aug 2014
Posts: 13
garybeck is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
If the images are in-line, right-clicking on them and choosing Insert Caption gives you the option of inserting it above or below the image. In either case, it's inserted into a normal paragraph (with the Caption Style applied)
I tried again it but it's still not working. Here's what I'm doing:

-I found one image that has the text-box style caption, that I want to change to in-line caption.

-I right click on the image, choose Format Drawing Canvas, and change the Layout to "inline with text"

-remove the old caption (that is text box style)

-create new caption

-the new caption is still in a floating text box. POO.

I confirmed the image has been changed to "inline with text" but I'm still getting a floating text box for the caption.

any other tricks to try?

thanks,
gary
Reply With Quote
  #6  
Old 08-19-2014, 09:25 PM
macropod's Avatar
macropod macropod is offline Issue with figure captions (word 2010) Windows 7 32bit Issue with figure captions (word 2010) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I haven't been able to replicate that.

Can you attach a document to a post with the offending image (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 06-02-2021, 03:16 AM
frulofthus frulofthus is offline Issue with figure captions (word 2010) Windows 10 Issue with figure captions (word 2010) Office 2019
Novice
 
Join Date: Jun 2021
Posts: 1
frulofthus is on a distinguished road
Default

I had the exact same problem. Word would just change the layout of the object back to "in front of text" no matter how many times I would change it to "in line with text" every time I added a caption. Really annoying!!
I have solved it now by making sure that I paste the figures in as pictures, not as shapes. Then all the captions appear as "in line with text".
Reply With Quote
  #8  
Old 06-02-2021, 02:53 PM
macropod's Avatar
macropod macropod is offline Issue with figure captions (word 2010) Windows 10 Issue with figure captions (word 2010) Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That might work for you - it won't work for anyone who wants to wrap the text around the image.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong numbering in Figure/Tables' captions Shauheen Word 6 06-13-2017 12:07 PM
Broken Table/Figure Captions with Headings kokopelli_2001 Word 1 06-07-2013 04:50 AM
Issue with figure captions (word 2010) Figure group and captions sdabach Word 3 02-21-2013 12:07 AM
Issue with figure captions (word 2010) Independent figure captions steel_lady Word 4 08-21-2012 04:33 PM
Word 2010 image and table captions style chaji Word 0 09-22-2010 03:59 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft