Jeremy ,

We have sam problems with Writerdocs, after placing some pictures "StoreToURL" gives somtimes a IO exception. I supose due to the fact that the embeded picture houshold is not
totaly in order.
There for we check if the URL is existent if not we use StoreToURL else we do Doc.store who gives no troubles. When using StoreAsURL, the API overwrite the doc but then it can no longer been saved by the GUI. (gives a General IO error)

Hope it helps

Fernand
I am trying to generate a powerpoint presentation, see code snippet:

public static void convert(XComponent xComponent, XComponentContext context,
String targetFilename, String conversionFilter)

{

        // How to get the XComponent, see
../Office/Office.OpenDocumentFromURL.snip

        XStorable xStorable = (XStorable)

        UnoRuntime.queryInterface(XStorable.class, xComponent);

        // Set properties for conversions

        PropertyValue[] conversionProperties = new PropertyValue[2];

        conversionProperties[0] = new PropertyValue();

        conversionProperties[0].Name = "Overwrite";

        conversionProperties[0].Value = new Boolean(true);

        conversionProperties[1] = new PropertyValue();

        conversionProperties[1].Name = "FilterName";

        conversionProperties[1].Value = conversionFilter;

        // Convert

        try {

            xStorable.storeToURL(createUNOFileURL(targetFilename, context),
conversionProperties);

        }

        catch (com.sun.star.io.IOException ex) {

            jL.warning("Error occured during conversion");

            ex.printStackTrace();

        }

    }

The problem I am having is a weird one. I am generating all kinds of
different slides (title slide, bullet slides, table slides, image slides).

Everything works great if I don't generate any image slides. I can generate
many presentations without a problem. The soffice.bin start and shuts down
gracefully, but if I try and generate an image slide the soffice.bin crashes
in an unreliable fashion. Sometimes it works and sometimes it crashes. I'm
not really sure what to do because I generate the same presentation over and
over again with the exact same parameters, but again soffice.bin crashes
sometimes, and sometimes it doesn't.
Are there any known issues with adding images to slides? This is the code
that I am using to add the image to the slide:

for (int j = 0; j < xNewPage.getCount(); j++) {

                Object oo = xNewPage.getByIndex(j);

                XShape xShape = (XShape)
UnoRuntime.queryInterface(XShape.class, oo);

                String type = xShape.getShapeType();

                XText xText = (XText) UnoRuntime.queryInterface(XText.class,
xShape);

                if (xText != null) {

                    if
(type.equals("com.sun.star.presentation.TitleTextShape")) {

                        xText.setString(jTitle);

                    } else if
(type.equals("com.sun.star.presentation.OutlinerShape")) {

                        String bullets = "";

                        for (String bullet : jBulletList) {

                            bullets += bullet + "\n";

                        }

                        xText.setString(bullets);

                    } else if
(type.equals("com.sun.star.drawing.GraphicObjectShape")) {

                        XPropertySet xPropertySet = (XPropertySet)
UnoRuntime.queryInterface(

                                XPropertySet.class, xShape);

                        xPropertySet.setPropertyValue("GraphicURL",
Util.createUNOFileURL(

                                jImagePath,

                                context));

                    }

                }

            }

Any help would be much appreciated.




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to