Adding a image to a gridcontrol row using BASIC

Fernand Vanrie sos at pmgroup.be
Sat Jun 6 03:09:20 PDT 2015


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150606/e2ab1c15/attachment.html>


More information about the LibreOffice mailing list