[Solved] Directly embed images from web inside Writer docs
[Solved] Directly embed images from web inside Writer docs
copying & pasting images from webpages into OOo Writes docs is not as easy as in MS Word.
MS Word directly embeds images in the document while OOo has a different behaviour and embedding must be done manually.
You have to paste the text and images into a text document, then use the Edit > Links box to break links to the images to embed them in the document.
this manual method is not very user friendly (expecially fo newbies) and is time consuming if you have multiple pictures to embed.
i'd like to have a macro o extension that can directly embed images in witer documents after capy&paste from web.
unfortunately i have no skills to code such a macro, so i wonder if one of the macro experts of this forum can do it.
thank you.
Related topics:
http://user.services.openoffice.org/en/ ... a&start=10
http://www.oooforum.org/forum/viewtopic ... sc&start=0
MS Word directly embeds images in the document while OOo has a different behaviour and embedding must be done manually.
You have to paste the text and images into a text document, then use the Edit > Links box to break links to the images to embed them in the document.
this manual method is not very user friendly (expecially fo newbies) and is time consuming if you have multiple pictures to embed.
i'd like to have a macro o extension that can directly embed images in witer documents after capy&paste from web.
unfortunately i have no skills to code such a macro, so i wonder if one of the macro experts of this forum can do it.
thank you.
Related topics:
http://user.services.openoffice.org/en/ ... a&start=10
http://www.oooforum.org/forum/viewtopic ... sc&start=0
Last edited by Tommy on Sun Feb 17, 2008 5:10 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] directly embed images from web inside Writer docs
No macro help but if you have a lot of images just select them all before click "Break Link". The first will be selected, just Shift + click on the last. Try it with a copy of this thread.
Re: [REQ] directly embed images from web inside Writer docs
i tried to record that sequence as a macro
the only thing is that the Shift + click has to be done manually.
is there any macro guru that can edit my code and automatize this last step as well?
Code: Select all
sub BreakImageLinks
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:LinkDialog", "", 0, Array())
end sub
is there any macro guru that can edit my code and automatize this last step as well?
-----
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] directly embed images from web inside Writer docs
Andrew has multiple code examples in his free macro document
Re: [REQ] directly embed images from web inside Writer docs
i'm analphabet with macro code.
i'd take ages to learn it...
i'd take ages to learn it...
-----
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] directly embed images from web inside Writer docs
I think i saw working macro code in another forum today - but have no time to search for it now (and test it) .... maybe later this night - stay tuned
Re: [REQ] directly embed images from web inside Writer docs
i keep my fingers crossed.
you are a macro wizard, i know you will do it!!!
you are a macro wizard, i know you will do it!!!
-----
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] directly embed images from web inside Writer docs
any news my friend?
did u find anything useful?
did u find anything useful?
-----
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] directly embed images from web inside Writer docs
Had a deeper look - and don't see an easy way.
Problem is, that loading the image from web with code times out.
So you will manually have to download the images (with same name as link, preferable). Adopting Andrew's macro should be a work of diligence - not for me in near future...
Problem is, that loading the image from web with code times out.
So you will manually have to download the images (with same name as link, preferable). Adopting Andrew's macro should be a work of diligence - not for me in near future...
Re: [REQ] directly embed images from web inside Writer docs
ok, nevermind.
my macro does much of the work.
only few click are required for the user and is not that time consuming.
if the "Ctrl-Shift selection and break links command" thing cannot be automized is not so important.
i will put a [solved] tag to the topic.
however, if anybody will find how to code a better macro than mine, please post it here!!!
my macro does much of the work.
only few click are required for the user and is not that time consuming.
if the "Ctrl-Shift selection and break links command" thing cannot be automized is not so important.
i will put a [solved] tag to the topic.
however, if anybody will find how to code a better macro than mine, please post it here!!!
-----
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] directly embed images from web inside Writer docs
i found a better macro that does all the job with just one click.
credits to pablo from the italian OOo Google Discussion Group
http://groups.google.it/group/it-alt.co ... b8074f73d2
credits to pablo from the italian OOo Google Discussion Group
http://groups.google.it/group/it-alt.co ... b8074f73d2
Code: Select all
Sub EmbedGraphics()
oDPage = ThisComponent.DrawPage
oProvider = createUnoService("com.sun.star.graphic.GraphicProvider")
Dim oProps(0) as new com.sun.star.beans.PropertyValue
oProps(0).Name = "URL"
If oDPage.hasElements() Then
For I = 0 To oDPage.Count - 1
oGraph = oDPage.getByIndex(I)
If oGraph.supportsService("com.sun.star.text.TextGraphicObject") Then
oProps(0).Value = oGraph.GraphicUrl
oGraph.Graphic = oProvider.queryGraphic(oProps())
End If
Next I
End If
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] Directly embed images from web inside Writer docs
The previous post converts one type of image. From my free macro document, we have the following, which converts GraphicObjectShape and TextGraphicObject.
Code: Select all
Sub ConvertAllLinkedGraphics(Optional aDoc)
Dim oDoc ' Working document
Dim oDP ' Draw page
Dim i% ' Index counter
Dim oGraph ' Graph object in the draw page
Dim iLinked% ' Number of linked graphics
Dim iEmbedded% ' Number of embedded graphics
Dim iConverted% ' Linked graphics converted to embedded
Dim s1$ ' Graphic service name
Dim s2$ ' Graphic service name
REM Only know how to convert these types
s1 = "com.sun.star.drawing.GraphicObjectShape"
s2 = "com.sun.star.text.TextGraphicObject"
If IsMissing(aDoc) OR IsNull(aDoc) OR IsEmpty(aDoc) Then
oDoc = ThisComponent
Else
oDoc = aDoc
End If
REM Get the document draw page and then enumerate the graphics.
oDP = oDoc.getDrawPage()
For i=0 To oDP.getCount()-1
oGraph = oDP.getByIndex(i)
If oGraph.supportsService(s1) OR oGraph.supportsService(s2) Then
If InStr(oGraph.GraphicURL, "vnd.sun") <> 0 Then
iEmbedded = iEmbedded + 1
Else
iLinked = iLinked + 1
If EmbedLinkedGraphic(oGraph, oDoc) Then
iConverted = iConverted + 1
End If
End If
End If
Next
Print "Found " & iLinked & " linked and " & iEmbedded & _
" embedded graphics and converted " & iConverted
End Sub
Function EmbedLinkedGraphic(oGraph, oDoc) As Boolean
REM Author: Andrew Pitonyak
Dim sGraphURL$ ' External URL of the graphic.
Dim oGraph_2 ' Created graphic.
Dim oCurs ' Cursor where the graphic is located.
Dim oText ' Text object containing graphic.
Dim oAnchor ' Anchor point of the image
Dim s1$ ' Graphic service name
Dim s2$ ' Graphic service name
EmbedLinkedGraphic = False
If InStr(oGraph.GraphicURL, "vnd.sun") <> 0 Then
REM Ignore an image that is already embedded
Exit Function
End If
s1 = "com.sun.star.drawing.GraphicObjectShape"
s2 = "com.sun.star.text.TextGraphicObject"
If oGraph.supportsService(s1) Then
REM Convert a GraphicObjectShape.
oAnchor = oGraph.getAnchor()
oText = oAnchor.getText()
oGraph_2 = ThisComponent.createInstance(s)
oGraph_2.GraphicObjectFillBitmap = oGraph.GraphicObjectFillBitmap
oGraph_2.Size = oGraph.Size
oGraph_2.Position = oGraph.Position
oText.insertTextContent(oAnchor, oGraph_2, False)
oText.removeTextContent(oGraph)
EmbedLinkedGraphic = True
ElseIf oGraph.supportsService(s2) Then
REM Convert a TextGraphicObject.
Dim oBitmaps
Dim sNewURL$
Dim sName$
sName$ = oGraph.LinkDisplayName
oBitmaps = oDoc.createInstance( "com.sun.star.drawing.BitmapTable" )
If oBitMaps.hasByName(sName) Then
Print "Link display name " & sName & " already exists"
Exit Function
End If
'Print "Ready to insert " & sName
oBitmaps.insertByName( sName, oGraph.GraphicURL )
sNewURL$ = oBitmaps.getByName( sName )
'Print "inserted URL " & sNewURL
oGraph.GraphicURL = sNewURL
EmbedLinkedGraphic = True
End If
End Function
Re: [Solved] Directly embed images from web inside Writer docs
sorry i did not understand which is the difference from your macro and the one i posted above.
could you try to expain it again?
thanks
could you try to expain it again?
thanks
-----
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] Directly embed images from web inside Writer docs
*up*
-----
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
-
- Posts: 21
- Joined: Sat Apr 11, 2009 11:57 pm
Re: Directly embed images from web inside Writer docs
In Writer Macro's I've pasted the last macro published here. I really don't know how to work macro's, and so I don't know where to put my link...
I know it's stupid, but please help me from the start...So I open a blanc Writer Doc, and want to embed for example www.google.com.
What do I do?
Thanks,
Anton van Horen
I know it's stupid, but please help me from the start...So I open a blanc Writer Doc, and want to embed for example www.google.com.
What do I do?
Thanks,
Anton van Horen
OOo 3.0.X on Ms Windows XP
Re: [Solved] Directly embed images from web inside Writer docs
FYI. someone might need this
An issue similar to this[solved], in java Find here
An issue similar to this[solved], in java Find here
GOOO 3.1.1 on Windows XP
Re: [Solved] Directly embed images from web inside Writer docs
-----
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
-
- Posts: 3
- Joined: Mon Jul 27, 2009 11:20 am
Re: [Solved] Directly embed images from web inside Writer docs
The method of breaking the links, doesn't seem to work for me.
When I do it, the images just say "Read error", and noting is displayed.
Have anyone else had this error? And does someone know how to fix it?
When I do it, the images just say "Read error", and noting is displayed.
Have anyone else had this error? And does someone know how to fix it?
OOo 3.1.X on Ms Windows XP + Mac OSX 10.5.7