Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


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"}  );



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.