Is there an API call to break links (equivalent of " Edit->Links->Break Link" in the UI)? I want to keep the Word Document and data intact but break the link and embedd the images in the docuemnt itself.
I have seen this happening in VB here.
I am very new to UNO API .. i don't have enough time to dig up and use it Could someone help me in doing this. After trying a lot i reached till this:
Can someone help me from here.
NOTE: The following code is incomplete and might have many mistakes. Please do not use
Code: Select all
public final void embedImagesInWriter(XComponent oDoc)
{
XTextGraphicObjectsSupplier XTxtGraphObjSupplier = (XTextGraphicObjectsSupplier) UnoRuntime.queryInterface(XTextGraphicObjectsSupplier.class, oDoc);
XNameAccess XNameAcc;
XMultiServiceFactory xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc);
Object oGraphic = xMSFDoc.createInstance("com.sun.star.text.TextGraphicObject");
String[] allImages = null;
int x = 0;
PropertyValue[] aMediaProperties = new PropertyValue[1];
XNameAcc = XTxtGraphObjSupplier.getGraphicObjects();
allImages = XNameAcc.getElementNames();
XGraphicProvider XGraphProv = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, oDoc);
for (x = 0; x < allImages.length; x++)
{
oGraphic = XNameAcc.getByName(allImages[x]);
aMediaProperties = MakePropertyValue("URL", oGraphic.GraphicURL);
oGraphic.Graphic = XGraphProv.queryGraphic(aMediaProperties);
}
}
public final Object MakePropertyValue(String cName, Object uValue)
{
PropertyValue[] tempMakePropertyValue = new PropertyValue[1];
tempMakePropertyValue[0].Name = cName;
tempMakePropertyValue[0].Value= uValue;
return tempMakePropertyValue;
}
Code: Select all
oGraphic.GraphicURL
Code: Select all
oGraphic.Graphic
Something is seriously wrong in this code .. please correct it.
Thank you