PDA

View Full Version : Converting InlineShapes to Shapes



shiamak
09-26-2007, 11:23 AM
Hello,

I have document with Booksmarks , I need to add graphics and text to it. I am able to add grpahics and text howerver when I convert inlineshapes to shapes the grpahics go beyond the lenght of the page. It actually adds another page.

I need to do it in word 2000 . OR is there a way to add .Shapes to bookmarks?

Any help is appreciated
TIA

TonyJollans
09-26-2007, 10:42 PM
Not really enough to go on there. I can't quickly duplicate what you say and would not normally expect it. Can you post a sample document?

shiamak
09-27-2007, 09:46 AM
Not really enough to go on there. I can't quickly duplicate what you say and would not normally expect it. Can you post a sample document?


Hi There,

I am not sure how to post a document here however just to make easy to understand...

Lets say you have a .dot template that contains a table with 8 columns, now you need to give the user ability to select a graphic (Pic etc) and fill all the columns with the selected pic and aligin them in center in each cell.

I have used InlineShapes but its not always aligned however .Shapes works better (this object has more properties for aliginging) but after inserting pics/images , it pushes the table cells to the next page.

I hope this makes it clear.

TIA

TonyJollans
09-27-2007, 11:58 AM
Set the Table property .AllowAutoFit=False

This will stop the columns being scaled to the pictures and force the pictures to be scaled to the columns.

shiamak
09-27-2007, 01:07 PM
Set the Table property .AllowAutoFit=False

This will stop the columns being scaled to the pictures and force the pictures to be scaled to the columns.

Thanks! and where I would specify .AllowAutoFit = false?

Thanks
pradeep

TonyJollans
09-27-2007, 01:15 PM
In VBA ...

TableRef.AllowAutoFit = False

Or via the UI. Table > Properties > Table tab > Options > Check the box

shiamak
09-27-2007, 01:21 PM
In VBA ...

TableRef.AllowAutoFit = False
Or via the UI. Table > Properties > Table tab > Options > Check the box

Tony,

I tried it but it didnt do the trick, the graphic is still falling out of table.

Let me tell u what i am doing.

I am first inserting .InlineShapes using bookmarks then I am converting all inlineshapes to .Shapes, it is at this time while converting to shapes all the images are falling out of their cells.

Any inputs is appreciated.

TonyJollans
09-27-2007, 01:54 PM
I don't have Word 2000 handy to check but I have no trouble with either Shapes or InlineShapes fitting and aligning in table cells in 2003. I'll try on 2000 later.

shiamak
09-27-2007, 03:15 PM
I don't have Word 2000 handy to check but I have no trouble with either Shapes or InlineShapes fitting and aligning in table cells in 2003. I'll try on 2000 later.

For me also 2003 works fine, it is word 2000 I am having problem with!


TIA

TonyJollans
09-27-2007, 03:57 PM
Worls OK for me in 2000 as well.

Can you post a document with the problem?

shiamak
09-27-2007, 04:58 PM
Worls OK for me in 2000 as well.

Can you post a document with the problem?

Could you post the code that you tried ,where you first inserted .inlineShapes into cells of a table using bookmarks then coverted them (inlineshapes) to shapes without any problems?

TIA

TonyJollans
09-27-2007, 09:09 PM
OK - I did a lot of it manually to test it out but, as you ask, I threw this together - part recorded, part cut and pasted, part hacked - and it creates a table of four columns with a bookmark in each cell. It makes all the columns different widths and I end up with the same picture perfectly aligned and differently scaled in each cell of the top row


Sub Macro10()
Dim tbl As Table, cel As Cell
Set tbl = ActiveDocument.Tables.Add(ActiveDocument.Range(0, 0), 3, 4)
tbl.Columns(1).Width = CentimetersToPoints(2)
tbl.Columns(2).Width = CentimetersToPoints(3)
tbl.Columns(3).Width = CentimetersToPoints(4)
tbl.Columns(4).Width = CentimetersToPoints(5)
For Each cel In tbl.Range.Cells
cel.Range.Bookmarks.Add "BK" & cel.RowIndex & cel.ColumnIndex
Next cel
ActiveDocument.Range.Bookmarks("BK11").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
ActiveDocument.Range.Bookmarks("BK12").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
ActiveDocument.Range.Bookmarks("BK13").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
ActiveDocument.Range.Bookmarks("BK14").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
Dim ish As InlineShape
Dim sh As Shape
For Each ish In ActiveDocument.Tables(1).Range.InlineShapes
Set sh = ish.ConvertToShape
Next ish

End Sub

shiamak
09-28-2007, 09:05 AM
OK - I did a lot of it manually to test it out but, as you ask, I threw this together - part recorded, part cut and pasted, part hacked - and it creates a table of four columns with a bookmark in each cell. It makes all the columns different widths and I end up with the same picture perfectly aligned and differently scaled in each cell of the top row


Sub Macro10()
Dim tbl As Table, cel As Cell
Set tbl = ActiveDocument.Tables.Add(ActiveDocument.Range(0, 0), 3, 4)
tbl.Columns(1).Width = CentimetersToPoints(2)
tbl.Columns(2).Width = CentimetersToPoints(3)
tbl.Columns(3).Width = CentimetersToPoints(4)
tbl.Columns(4).Width = CentimetersToPoints(5)
For Each cel In tbl.Range.Cells
cel.Range.Bookmarks.Add "BK" & cel.RowIndex & cel.ColumnIndex
Next cel
ActiveDocument.Range.Bookmarks("BK11").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
ActiveDocument.Range.Bookmarks("BK12").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
ActiveDocument.Range.Bookmarks("BK13").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
ActiveDocument.Range.Bookmarks("BK14").Range.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\comet\My Documents\My Pictures\Bluebells - 4.JPG" _
, LinkToFile:=False, SaveWithDocument:=True
Dim ish As InlineShape
Dim sh As Shape
For Each ish In ActiveDocument.Tables(1).Range.InlineShapes
Set sh = ish.ConvertToShape
Next ish

End Sub


Hi ,

Thanks for your help though I am not sure if if you noticed that after you convert .InlineShapes to Shapes the images are falling out of the table cell..
is it intentional?
Thanks

TonyJollans
09-28-2007, 10:09 AM
They don't fall out of the cells for me - I can't even make them do it by playing with options. Guessing now - might there be something about your pictures that means Word can't scale them?