OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

macro import html screws up images
Goto page Previous  1, 2
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
johnny7
General User
General User


Joined: 21 May 2004
Posts: 10

PostPosted: Mon Jun 07, 2004 2:32 am    Post subject: Reply with quote

I tried to search for the graphic objects and do some manipulating.
The following macro doesn't work, the generated document contains a wrongly scaled image.
Code:

Sub ConvertHTMLToSXW( )
   'cURL = ConvertToURL( cFile )
   cFile = "file://c:/testoo/test.html"
   cURL = ConvertToURL( cFile )
   
   oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(_
            MakePropertyValue( "FilterName", "HTML (StarWriter)" ),_
            ) )

   oImages = oDoc.getGraphicObjects()
   For i=0 to oImages.count - 1
      'Print "height: "+oImages(i).Height+";width: "+oImages(i).Width
   Next
   
   cFile = Left( cFile, Len( cFile ) - 4 ) + "sxw"
   cURL = ConvertToURL( cFile )
   
   ' Save the document using a filter.
   oDoc.storeToURL( cURL, Array(_
            MakePropertyValue( "FilterName", "StarOffice XML (Writer)" ),_
            )     
   oDoc.close( True )
End Sub

The contents of test.html
Code:

<html><body><img src="distress_sigs.jpg" width=350></body></html>


If I however remove the comment quote in the macro from the following line
Code:

'Print "height: "+oImages(i).Height+";width: "+oImages(i).Width

the generated document contains a well-scaled image.
This seems a bug to me. Any ideas or comments?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group