Dear Community of OO Spreadsheet:

I could not figure out how to correctly call the queryEmptyCells() API
function.  Does queryEmptyCells() implicitly depend on the state of the
current cursor in a spreadsheet?  I could not find the answer in the OO
Developers Guide, version 2.0.  I appreciate your advice on where my
mistake is.  Thanks.

Ray

 -----

The symptoms can be divided into two types:

* a brand new spreadsheet file
  a brand new and empty spreadsheet
  no content in any cell

  aXCellRange.queryEmptyCells() always returns nothing
  regardless what the range is set to.

* a brand new spreadsheet file
  a brand new spreadsheet
  one single cell filled with content

  aXCellRange.queryEmptyCells() returns a correct result
  only if the range includes the cell with content.
  It returns nothing for all other settings of spreadsheet ranges,
  be it a row range, a column range, a block range,
  as long as the range excludes the cell with content.

 -----

Environment:
MS Windows XP
OO 2.2.0
Beanshell 2.0.b4, standalone, not OO Beanshell (embedded in OO)
   remember to include the 4 basic OO *.jar files in classpath,
   as instructed in the OO Developers Guide 2.0

// follow the instructions in OO Developers Guide 2.0
// bootstrap OO
// create a brand new spreadsheet file, default load mode (null for
PropertyValue)
// get the object of the spreadsheet "Sheet1" in this new spreadsheet
file
// Let us call this spreadsheet object: onesshtt

import com.sun.star.sheet.XSpreadsheet;
Xspreadsheet onesshtt;

/* ----- scenario 2: one cell filled with content

import com.sun.star.table.XCell;
import com.sun.star.text.XText;
XCell tabl_cell;
XText text_cell;
tabl_cell = onesshtt.getCellRangeByName( "D20" ).getCellByPosition( 0, 0
);
text_cell = UnoRuntime.queryInterface( XText.class, tabl_cell );
text_cell.setString( "test D20" );

 scenario 2 ----- */

import com.sun.star.table.CellRangeAddress;
import com.sun.star.table.XCellRange;
import com.sun.star.sheet.XSheetCellRanges;
import com.sun.star.sheet.XCellRangesQuery;

XCellRange         tabl_rnng;
XCellRangesQuery   qrry;
XSheetCellRanges   fndd;
CellRangeAddress[] addr;

// change the range setting in anyway of your choice
tabl_rnng = onesshtt.getCellRangeByName( "A10:A100" );
qrry = UnoRuntime.queryInterface( XCellRangesQuery.class, tabl_rnng );
fndd = qrry.queryEmptyCells();
addr = fndd.getRangeAddresses();

print( "count=" + addr.length + ", addr=" +
fndd.getRangeAddressesAsString() );




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to