F
Feederman
Hi Guys,
Im currently building an application to convert all pictures in a
document into a certain format. Im know my way around the object model
very well but have hit a serious brick wall when tryin to set the
Width's and Height's of a InlineShape.
Due to the nature of the application the new converted pictures must be
in an identical position and have the same width and height to the
original. Your probably thinking, well just set the width and height
using InlineShape.Width = etc. Well ofcourse this works but as far as
I can see it doesn't always work to exact precision when using
numbers with a decimal place. I.e You don't always get the width
/height that are shown in the FormatPicture dialog in word.
The only way I have found to get these values is to talk to the format
picture dialog itself. Using the old nasty interface you can access
the following propertys for the format picture dialog for the selected
object.
SetSize, CropLeft, CropRight, CropTop, CropBottom, ScaleX, ScaleY,
SizeX, SizeY
You would think you could just call set SizeX with InvokeMember and the
SetProperty flag and it would work, nah that would be too easy!
Unfortunatly this doesn't work as the ScaleX property seems to
override whatever you set the SizeX too. So if ScaleX = 50% and I set
SizeX = 10, ScaleX should be recalcaulated but its not, even after you
call dlg.Execute();
Theres one property of the FormatPicture dialog that I think could
could be my savoir, "SetSize". By the sounds of it, this would
allow me to set the size as if I had typed it into the dialog myself
and therefore work to precision. Unfortunatly due to Microsofts lack
of documentation I have no idea what type of object to pass it as the
arguments. Ive tried (Width, Height) a Size Structure all sorts, all
result in exceptions. Ive looked everywhere on the net to try to
find out what the parameter types are but have no success.
So you guys are my last hope, does anyone know what SetSize takes, or
anyone willin to make an educated guess, im that desperate lol!
Thanks for your help as always, where would I be without GoogleGroups
I don't know!
Cheers
Simon Turner
Im currently building an application to convert all pictures in a
document into a certain format. Im know my way around the object model
very well but have hit a serious brick wall when tryin to set the
Width's and Height's of a InlineShape.
Due to the nature of the application the new converted pictures must be
in an identical position and have the same width and height to the
original. Your probably thinking, well just set the width and height
using InlineShape.Width = etc. Well ofcourse this works but as far as
I can see it doesn't always work to exact precision when using
numbers with a decimal place. I.e You don't always get the width
/height that are shown in the FormatPicture dialog in word.
The only way I have found to get these values is to talk to the format
picture dialog itself. Using the old nasty interface you can access
the following propertys for the format picture dialog for the selected
object.
SetSize, CropLeft, CropRight, CropTop, CropBottom, ScaleX, ScaleY,
SizeX, SizeY
You would think you could just call set SizeX with InvokeMember and the
SetProperty flag and it would work, nah that would be too easy!
Unfortunatly this doesn't work as the ScaleX property seems to
override whatever you set the SizeX too. So if ScaleX = 50% and I set
SizeX = 10, ScaleX should be recalcaulated but its not, even after you
call dlg.Execute();
Theres one property of the FormatPicture dialog that I think could
could be my savoir, "SetSize". By the sounds of it, this would
allow me to set the size as if I had typed it into the dialog myself
and therefore work to precision. Unfortunatly due to Microsofts lack
of documentation I have no idea what type of object to pass it as the
arguments. Ive tried (Width, Height) a Size Structure all sorts, all
result in exceptions. Ive looked everywhere on the net to try to
find out what the parameter types are but have no success.
So you guys are my last hope, does anyone know what SetSize takes, or
anyone willin to make an educated guess, im that desperate lol!
Thanks for your help as always, where would I be without GoogleGroups
I don't know!
Cheers
Simon Turner