[C#] OOoDraw XText not writing text

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
scottadamson
Posts: 2
Joined: Thu May 21, 2015 8:13 am

[C#] OOoDraw XText not writing text

Post by scottadamson »

trying to write text in an open office draw document (open office 4.1.1 and sdk 4.1.1) and no text is written, included my code
the objects are being created but no text is written.

i can see the elipse in the document and if i drag select all i also see the empty text shape.

please help, im coverting over a set of powerpoint generators from being coupled to ms office powerpoint to openoffice impress, so far boot times and interaction times are far quicker than with powerpoint.

Code: Select all

        public void DrawOnDrawing(XComponent document)
        {
            XDrawPages xp = ((XDrawPagesSupplier) document).getDrawPages();
            XDrawPage xpage1 = xp.insertNewByIndex(0);
            XDrawPage xpage0 = (XDrawPage)xp.getByIndex(0).Value;
            xp.remove(xpage0);
            XMultiServiceFactory xDocMSF = (XMultiServiceFactory)document;
            XShape shape = (XShape)xDocMSF.createInstance("com.sun.star.drawing.EllipseShape");
            shape.setPosition(new unoidl.com.sun.star.awt.Point(100, 100));
            shape.setSize(new unoidl.com.sun.star.awt.Size(5000, 5000));
            XShape txtshape = (XShape)xDocMSF.createInstance("com.sun.star.drawing.TextShape");
            txtshape.setPosition(new unoidl.com.sun.star.awt.Point(6000, 6000));
            txtshape.setSize(new unoidl.com.sun.star.awt.Size(5000, 5000));
            ((XText)txtshape).setString("test text");
            ((XText)shape).setString("another test");
            xpage1.add(txtshape);
            xpage1.add(shape);
        }
openoffice 4.1.1 & 4.1.1 sdk on win 7
scottadamson
Posts: 2
Joined: Thu May 21, 2015 8:13 am

Re: [C#] OOoDraw XText not writing text

Post by scottadamson »

can anyone tell me if I am correct with the assumption that in C# I need to cast the shape as XText and use setString?

Code: Select all

  ((XText)txtshape).setString("test text");
any one see anything that I'm missing?

has anyone tried to produce presentations or drawings by code using Open Office and C#?
openoffice 4.1.1 & 4.1.1 sdk on win 7
Post Reply