Resizing image (Word 2010)

Jack21
2StarLounger
Posts: 107
Joined: 23 Mar 2010, 13:42

Resizing image (Word 2010)

Post by Jack21 »

Hi - can anyone help?

Recently I called in Microsoft to assist with a piece or work around images to enable interchangeable logos to appear on newly created documentation. The image as it is inserted into the content control is the incorrect size and after taking a look it seems I need to enusre the lock aspect ratio is checked and set the image to 32%.

The image is a System.Drawing.Bitmap and after taking a look it appears that I cannot get access to the lock aspect ratio with this object. It seems that I can for a Shape object but am struggling to set the image as a shape.

Does anyone have any idea how I can change the lock aspect ratio and set the image to 32%?

Many thanks in advance.
Jack

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Resizing image (Word 2010)

Post by HansV »

Do you have a particular reason for placing the image in a content control instead of directly in the document?
Best wishes,
Hans

Jack21
2StarLounger
Posts: 107
Joined: 23 Mar 2010, 13:42

Re: Resizing image (Word 2010)

Post by Jack21 »

The whole solution has been moved away from bookmarks to content controls and xml mapping, which seems to work well. This also gives scope for language changes going forward as I need to incorporate French, Italian, German and English into the solution. With the image content control, I believe it was just a case of consistency. The image content control is placed on the template, when the user creates a document, the code checks to see what company they work for and the relevant logo populates into the document.

The problem I have is that the logo needs to be 32% so that the brand is not compromised. Any suggestions would be greatly appreciated.

Thanks
Jack

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Resizing image (Word 2010)

Post by HansV »

Something like this works for me:

Code: Select all

    With ActiveDocument.SelectContentControlsByTitle("MyPic").Item(1).Range.InlineShapes(1)
        .LockAspectRatio = True
        .ScaleHeight = 32
    End With
Best wishes,
Hans

Jack21
2StarLounger
Posts: 107
Joined: 23 Mar 2010, 13:42

Re: Resizing image (Word 2010)

Post by Jack21 »

Thanks for your help Hans but someone has pointed me in the direction of a new application that gives the ability to resize and save the image. It's free and called Paint.NET (http://download.cnet.com/Paint-NET/3000 ... 38146.html" onclick="window.open(this.href);return false;) - works like a charm.

Regards
Jack

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Resizing image (Word 2010)

Post by HansV »

I'm glad you found a solution!
Best wishes,
Hans

Jack21
2StarLounger
Posts: 107
Joined: 23 Mar 2010, 13:42

Re: Resizing image (Word 2010)

Post by Jack21 »

Alas there I was thinking it had all come together but have been informed by the image experts that I need to make a slight change to the placement !! Does anyone know how to programmatically set the image to be text wrapping, in front of text?

Thanks
Jack

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Resizing image (Word 2010)

Post by HansV »

Still within the image content control?
Best wishes,
Hans

Jack21
2StarLounger
Posts: 107
Joined: 23 Mar 2010, 13:42

Re: Resizing image (Word 2010)

Post by Jack21 »

Hi Hans

No I removed the content control and have a Word.InlineShape object to give me more control.

Regards
Jack

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Resizing image (Word 2010)

Post by HansV »

Code could look like this:

ActiveDocument.InlineShapes(1).ConvertToShape.WrapFormat.Type = wdWrapFront
Best wishes,
Hans

Jack21
2StarLounger
Posts: 107
Joined: 23 Mar 2010, 13:42

Re: Resizing image (Word 2010)

Post by Jack21 »

Seriously Hans ..... you truly are a "Clever Clogs".

Many thanks
Jack