Hello,

on a Openoffice wiki page i found some JAVA code to add a image into a GridControl Row what i need is how to make a "Object array" in BASIC who supports graphics and octher data

thanks for any hint

The main change in milestone 3 regarding DataModel is the possibility to add not only text but also images. That's why addRow-method has as second parameter no more string array but object array. Futher supported types are int, double, float.

/Java/

 Object  dataModel=  xMultiComponentFactory.createInstanceWithContext(
                "com.sun.star.awt.grid.DefaultGridDataModel", m_xContext);
 XGridDataModel xGridDataModel=  (XGridDataModel)  UnoRuntime.queryInterface(
                XGridDataModel.class, dataModel);
 Object  oGraphicProvider=  
xMultiComponentFactory.createInstanceWithContext("com.sun.star.graphic.GraphicProvider",
 m_xContext);
 XGraphicProvider xGraphicProvider=  (XGraphicProvider)      
UnoRuntime.queryInterface(XGraphicProvider.class, oGraphicProvider);
 // create the graphic object
 PropertyValue[]  aPropertyValues=  new  PropertyValue[1];
 PropertyValue aPropertyValue=  new  PropertyValue();
 aPropertyValue.Name  =  "URL";
 aPropertyValue.Value  =  "file:///c:/myimages/testimage.png";
 aPropertyValues[0]  =  aPropertyValue;
 XGraphic xGraphic=  xGraphicProvider.queryGraphic(aPropertyValues);
 xGridDataModel.addRow("1",new  Object[]{xGraphic,"1,2",1.3});
 //one row which contains only text
 xGridDataModel.addRow("2",new  Object[]  {"2,1","2,2","1,3"}  );


_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to