i'd like to have a macro to aumtoatically resize to 50% (or to another custom value) an image embedded in a writer document
actually to do this you have to manually:
- ricght click on image
- select image menu entry
- select "cut" tab
- digit the % value you want
i'd like a macro (which could be assigned to an hotkey or a button) so i schould juast click on the image and digit the hotkey or press the button, to resize immediately the image.
i tried to record a macro doing the aforementioned operations but it doesn't work.
am i doing something wring?
[Solved] Resize image to 50%
[Solved] Resize image to 50%
Last edited by Tommy on Sun Dec 23, 2007 11:19 pm, edited 1 time in total.
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: [REQ] resize image to 50%
Hi Tommy!
Try this macro:Hope it helps!
Uros
Try this macro:
Code: Select all
Sub ResizeEmbeddedPictureInWriter
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocument = ThisComponent
oSelection = oDocument.CurrentSelection
If oSelection.ImplementationName <> "SwXTextGraphicObject" Then
MsgBox "Select image first..."
Exit Sub
End If
nFactor = InputBox("Resize factor in %:","Resizing picture...",50)
If Not(IsNumeric(nFactor)) Then Exit Sub
nFactor = Val(nFactor)/100
Dim oSize as new com.sun.star.awt.Size
oSize.Width = Int(oSelection.Width * nFactor)
oSize.Height = Int(oSelection.Height * nFactor)
oSelection.setSize(oSize)
End Sub
Uros
Re: [REQ] resize image to 50%


you should submit it to: http://www.ooomacros.org/index.php
thank you for your help!!!
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: [solved] resize image to 50%
come on uros, you should really submit this macro to OOoMacros
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: [solved] resize image to 50%
if you copy and paste and image from Draw into Writer, the "resize macro" doesn't work on that image.
should i create another macro for such operation? should i edit the original macro?
if anbody has an answer, please tell me
should i create another macro for such operation? should i edit the original macro?
if anbody has an answer, please tell me
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: [Solved] resize image to 50%
nevermind.
i found here the solution. ( http://groups.google.it/group/it-alt.co ... 6162de7245 )
here's the DrawImageResize macro.
credits to martello
i found here the solution. ( http://groups.google.it/group/it-alt.co ... 6162de7245 )
here's the DrawImageResize macro.
credits to martello
Code: Select all
Sub DrawImageResize
Dim oSize as new com.sun.star.awt.Size
oDocument = ThisComponent
oSelection = oDocument.CurrentSelection
sel=oSelection.getByIndex (0)
nFactor = InputBox("Resize factor in %:","Resizing picture...",50)
If Not(IsNumeric(nFactor)) Then Exit Sub
nFactor = Val(nFactor)/100
oSize.Width = Int(sel.size.Width * nFactor)
oSize.Height = Int(sel.size.Height * nFactor)
sel.setSize(oSize)
End Sub
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: [Solved] Resize image to 50%
Hello,
This was a great thread, thanks to Uros. I know it's quite a few years ago, but I was hoping on being able to resize the image into a standard "inch by inch" format.
Like I would like a macro that would resize the picture to 3" x 5" on writer. Although I appreciate uros' code for 50%, I was hoping on something like 3" x 5" in inches or in pixels is fine also. The reason why is that I receive a bunch of pictures that are different sizes.
Someone Please help!!! Thanks so much in advanced.
This was a great thread, thanks to Uros. I know it's quite a few years ago, but I was hoping on being able to resize the image into a standard "inch by inch" format.
Like I would like a macro that would resize the picture to 3" x 5" on writer. Although I appreciate uros' code for 50%, I was hoping on something like 3" x 5" in inches or in pixels is fine also. The reason why is that I receive a bunch of pictures that are different sizes.
Someone Please help!!! Thanks so much in advanced.
OpenOffice 3.3.0 on Windows 7 x64 Ultimate
Re: [Solved] Resize image to 50%
I'm not a big macro expert but I think that uros macro can be changed to obtain what you desire.
just taking a look to the code, I think that the crucial point is:
I think that we should modify the nFactor from a % value to a fixed value for width and lenght
just taking a look to the code, I think that the crucial point is:
Code: Select all
nFactor = InputBox("Resize factor in %:","Resizing picture...",50)
If Not(IsNumeric(nFactor)) Then Exit Sub
nFactor = Val(nFactor)/100
Dim oSize as new com.sun.star.awt.Size
oSize.Width = Int(oSelection.Width * nFactor)
oSize.Height = Int(oSelection.Height * nFactor)
I think that we should modify the nFactor from a % value to a fixed value for width and lenght
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354