Joseph,

Fine Job, but you can avoid the copy with "Dispatcher" using the Picture properties found in the writer doc, to avoid flickering you also can open the drwadoc in "hiden" mode please find my code i use to to this jobs feel free to use the parts you are interseted; SUB ExportGraphicNaar(oGraphic As SwXTextGraphicObject, sURLImageResized As String, iPixels As Integer) Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue '*********************************** mFileProperties(0).Name= "Hidden" '* open a sdraw hidden document * mFileProperties(0).Value= TRue '***********************************
   Dim oDrawDoc, oDrawPage, oDrawGraphic, odesktop As Object
       oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDrawDoc = oDesktop.LoadComponentFromURL("private:factory/sdraw","_blank",0,mFileProperties())
    oDrawPage = oDrawDoc.DrawPages(0)
   oDrawPage.Width = OO_MMW
   oDrawPage.Height = OO_MMH
oDrawGraphic = oDrawDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
   Dim SelSize As New com.sun.star.awt.Size
   SelSize.width =OO_MMW
      SelSize.height = OO_MMH
   oDrawGraphic.GraphicURL = sOriginalURL
   oDrawGraphic.Size = selsize
   oDrawPage.add(oDrawGraphic)
   Dim aFilterData (1) As new com.sun.star.beans.PropertyValue
   aFilterData(0).Name  = "PixelWidth"        '
   aFilterData(0).Value = oDrawPage.Width/100 * iPixels / 25.40
   aFilterData(1).Name  = "PixelHeight"
   aFilterData(1).Value = oDrawPage.Height/100 * iPixels / 25.40

   Export( oDrawPage, sURLImageResized , aFilterData() )
   On error resume Next
   oDrawDoc.Close(True)
   On error goto 0
END SUB

SUB Export( xObject, stempFileUrl As String, aFilterData )
   Dim xExporter As Object
xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
   xExporter.SetSourceDocument( xObject )
   Dim aArgs (2) As new com.sun.star.beans.PropertyValue
   'sOriginalURL = ConvertToURL(sOriginalURL)
   aArgs(0).Name  = "FilterName"
   aArgs(0).Value = "jpg"
   aArgs(1).Name  = "URL"
   aArgs(1).Value = stempFileURL
   aArgs(2).Name  = "FilterData"
   aArgs(2).Value = aFilterData
   xExporter.filter( aArgs() )
END SUB

hop it helps

Fernand

Dear CodeSnippet Maintainer,

I have created a new OOO Writer code snippet in Basic.
It exports all graphical objects, formulas, bitmaps, drawings, charts in hi-resolution PNG files.
Currently the resolution fixed to 300dpi, but can be changed.
It may be really helpful for people e.g. who want to export high-quality drawings or formulas from Openoffice Writer documents.

Tested on Windows, v3.1.1, works well.
The code put into a sample Writer document.
License is freeware.

Best regards
Joseph Ostor

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to