java - OpenOffice API: Saving Impress (presentation) document as self-contained file -
java - OpenOffice API: Saving Impress (presentation) document as self-contained file -
when save 'ms powerpoint 97' filter, image files used in graphicobjectshape
objects linked, not contained in file.
is there property of filter or document-property create ooo create self-contained file (image files embedded instead of linked)?
edit:
the xlinkagesupport object has breaklink
function. clues how obtain these interfaces?
you can embed images ooo document thru com.sun.star.drawing.bitmaptable
object. next function take document (its xmultiservicefactory
interface), file
object pointing image file of selection , internalname has unique, embeds image , returns url pointing embedded instance.
/** * embeds image document , gets new url. * * @param mill factory interface of document. * @param file image file. * @param internalname name of image used within document. * @return url of embedded image. */ public static string embedlocalimage(xmultiservicefactory factory, file localfile, string internalname) { // future homecoming value string newurl = null; // url of file (note bitmaptable expects urls starting // "file://" rather "file:". note getrawpath() // homecoming encoded url (with special character in form of %xx). string imageurl = "file://" + localfile.touri().getrawpath(); seek { // bitmaptable object document (and interface) object bitmaptable = factory.createinstance("com.sun.star.drawing.bitmaptable"); xnamecontainer bitmapcontainer = (xnamecontainer)unoruntime.queryinterface(xnamecontainer.class, bitmaptable); // insert image url table bitmapcontainer.insertbyname(internalname, imageurl); // interface xnameaccess bitmapaccess = (xnameaccess)unoruntime.queryinterface(xnameaccess.class, bitmaptable); // embedded url newurl = (string)bitmapaccess.getbyname(internalname); } grab (exception e) { throw new runtimeexception(e); } // homecoming new (embedded) url homecoming newurl; }
java openoffice.org openoffice-impress
Comments
Post a Comment