I'm be able to find the graphic object, but when i try to remove it, it remain and the string that i would be replace the image, it's inserted before the image...
This is my codesnippet:


XContentEnumerationAccess xSectionEnumerationAccess =(XContentEnumerationAccess) UnoRuntime.queryInterface(
XContentEnumerationAccess.class,aSection ); //aSection is a Section XEnumeration xSectionGraphicEnum = xSectionEnumerationAccess.createContentEnumeration("com.sun.star.text.TextGraphicObject");
Object aGraphic=null;
while (xSectionGraphicEnum.hasMoreElements())
{


aGraphic=xSectionGraphicEnum.nextElement();
XServiceInfo xServiceGraphicCont=(XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class,aGraphic);
if (xServiceGraphicCont.supportsService("com.sun.star.text.TextGraphicObject"))
{
System.out.println("Trovata un'immagine ancorata a, o come un carattere");
XTextContent xGraphic=(XTextContent)UnoRuntime.queryInterface(XTextContent.class,aGraphic);
XTextRange xTextRange = xGraphic.getAnchor();
XTextCursor xTextCursor=xText.createTextCursor();
XText xText = xTextCursor.getText();
xText.removeTextContent(xGraphic);
xText.insertString(xTextRange, "A STRING", false);
}
}



Please someone help me... Thanks to all Cristian

Tom Schindl ha scritto:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Codesnippets are your friend although written in OO-Basic:

http://codesnippets.services.openoffice.org/Writer/Writer.ExtractGfx.snip
http://codesnippets.services.openoffice.org/Writer/Writer.EnumerateContent.snip



A simple search on the snippet page with e.g.: graphic extract.

Tom

Cristian Fonti wrote:
| Hi to all,
| i would make a java method that search all my writer document, and
| remove all the images
| I search in the developer guide, but i  didn't find anything...except
| for the XTextGraphicObjectsSupplier, but i don't know how to use...
| Tanks to all
| Cristian
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
|
|



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to