Bugzilla – Attachment 146268 Details for
Bug 119872
add an option to extract and link all pictures from a writer document
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
ExtractWriterGraphics (LO 6.1)
ExtractWriterGraphics_LO61.txt (text/plain), 1.96 KB, created by
Oliver Brinzing
on 2018-11-03 14:42:49 UTC
(
hide
)
Description:
ExtractWriterGraphics (LO 6.1)
Filename:
MIME Type:
Creator:
Oliver Brinzing
Created:
2018-11-03 14:42:49 UTC
Size:
1.96 KB
patch
obsolete
>OPTION EXPLICIT > >Sub Start() > Call ExtractWriterGraphics(ThisComponent, "Pictures") > MsgBox "export finished" >End Sub > >Function ExtractWriterGraphics(oDocument, ByVal sFolderName as String) > > On Local Error Goto ErrorHandler > > Dim oGraphicProvider as Object > Dim oGraphics as Object > Dim oGraphicObj as Object > Dim oGraphic as Object > > Dim mFileProps(1) as New com.sun.star.beans.PropertyValue > > Dim sDestFolder as String > Dim mFileExt() as String > > Dim oUrl as New com.sun.star.util.URL > Dim oTransformer as Object > > Dim i as Integer > > ' create destination folder relative to document ... > oTransformer = createUnoService("com.sun.star.util.URLTransformer") > oUrl.Complete = oDocument.URL > oTransformer.parsestrict(oUrl) > > If sFolderName = "" Then > sFolderName = "Pictures" > EndIf > sDestfolder = "file://" & oURL.Path & sFolderName & "/" > > ' create backup... > oDocument.storeToURL(oURL.Complete + ".bak", mFileProps()) > > oGraphics = oDocument.getGraphicObjects > oGraphicProvider = createUnoService("com.sun.star.graphic.GraphicProvider") > > ' for all pictures in document ... > For i = 0 to oGraphics.getCount()-1 > oGraphicObj = oGraphics.getByIndex(i) > oGraphic = oGraphicObj.Graphic > > mFileExt() = Split(oGraphic.MimeType, "/", 2) > > mFileProps(0).Name = "URL" > mFileProps(0).Value = sDestFolder & oGraphicObj.Name & "." & mFileExt(1) > mFileProps(1).Name = "MimeType" > mFileProps(1).Value = oGraphic.MimeType > > oGraphicProvider.storeGraphic(oGraphic, mFileProps()) > > mFileProps(1).Name = "LoadAsLink" > mFileProps(1).Value = True > > oGraphic = oGraphicProvider.queryGraphic(mFileProps()) > oGraphicObj.Graphic = oGraphic > Next i > > ' this automatically removes the unused internal pictures > oDocument.store() > ExtractWriterGraphics = 0 > Exit Function > >ErrorHandler: > ExtractWriterGraphics = -1 >End Function
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 119872
:
144860
| 146268