Issue 58646 - xTableRows insertByIndex() method fails inserting new row to blank table
Summary: xTableRows insertByIndex() method fails inserting new row to blank table
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Keywords: oooqa
Depends on:
Reported: 2005-11-30 05:02 UTC by mr_than
Modified: 2013-07-30 02:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description mr_than 2005-11-30 05:02:57 UTC
I just updated to OOo version 2.0.m142/2.0.1rc from the 2.0 release version and
the insertByIndex( ) method which is being used in the following to create one
or more tables and insert rows into them. It still works fine on another machine
running OOo 2.0 release and has since I started using it on 1.1.2/3.

The exception thrown is: Illegal arguments










	at $Proxy23.insertByIndex(Unknown Source)

	at convert.DocumentCreator.createPartA(

	at convert.DocumentCreator.createDocs(


	at convert.CourseProfileGenerator.<init>(

	at convert.CourseProfileGenerator.Process(

	at convert.CourseProfileGenerator.main(

I'll include a full working sample tomorrow.

//break process through data and add tables with item headings as required
	  String prevAssessmentType = "";
	  XTextTable xTable = null;
          String assessText = "";          
					int rowNum = 1;         //iterate DOWN rows by rownum counter
          boolean firstItem = true;
          XTableRows xTableRows = null;     //XIndexAccess of the table rows for
adding table rows
          XPropertySet xTableProps = null;  //XTextTable properties
          TableColumnSeparator[] colWidth = { new TableColumnSeparator(
(short)8000, true) }; //set width of column to 80% - relative numbers of 10000

          Row aRow =;
          do { //if first item of a type or last item altogether
            if (!prevAssessmentType.equals(
aRow.getAttribute("AssessmentType").toString() ) ) {

              //add a new title to the page showing the assessment type
              // Insert the table into the document at the bookmark cursor's
              if (aRow.getAttribute("LongName") != null) {
aRow.getAttribute("LongName").toString(), true );
              //set new title para style to "Item Subheading" style defined in
              XPropertySet xTitleProps = (XPropertySet)UnoRuntime.queryInterface(
                      XPropertySet.class, assessmentCursor );
              xTitleProps.setPropertyValue("ParaStyleName", "Item Subheading" );
              //deselect title and write table to document

              //create a new table and add it to the page
              xTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class,
mxBaseDocFactory.createInstance("" ) );
              xTable.initialize( 1, 2);					    
              xtext.insertTextContent( assessmentCursor, xTable, false);

              // Get an XIndexAccess of the table rows for adding table rows
              xTableRows = xTable.getRows();
              // Access the XPropertySet of the table
              xTableProps = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xTable );
              xTableProps.setPropertyValue( "TableColumnSeparators", colWidth );
              xTableProps.setPropertyValue("Split", new Boolean(false) ); //keep
table together on a page

              //reset row counter
              rowNum = 1;              
						} else { //continue - create a new row
              xTableRows.insertByIndex( rowNum, 1 ); <-- fails here

          //add the row data to the row
          assessText = "";
          if (aRow.getAttribute("AssessmentNo") != null) {
            assessText = "Assessment item " +
aRow.getAttribute("AssessmentNo").toString() + ": ";
          if (aRow.getAttribute("AssessmentText") != null) {
            assessText +=
aRow.getAttribute("AssessmentText").toString().replaceAll( "<br ?/?>", ""
).replaceAll( "\r?\n", "\n" );
          if (assessText.length() > 0) {
            insertIntoCell("A" + rowNum, assessText, xTable);
          if (aRow.getAttribute("AssessmentPercentage") != null) {
            insertIntoCell("B" + rowNum,
aRow.getAttribute("AssessmentPercentage").toString() + "%", xTable);

          prevAssessmentType = aRow.getAttribute("AssessmentType").toString();
        } while( (aRow = != null );
Comment 1 michael.ruess 2005-12-07 10:41:28 UTC
MRU->FME: can you please have a look if this is of any worth to you or if this
is more for API? Thanks a lot!
Comment 2 frank.meies 2005-12-07 11:36:28 UTC
FME: Looks like an API issue. 
Comment 3 michael.ruess 2005-12-07 11:50:18 UTC
MRU->CN: could you please reassign to correct contact?
Comment 4 chne 2006-01-03 07:52:59 UTC
cn->mr_than: Can you tell me on which platform you are working. And can you
verify this behavior on a newer version of OOo. If the failure occure also on a
newer version please attach the full working example.
Comment 5 hwoarang 2006-03-01 02:10:34 UTC
Closing (worksforme) as there's no answer from reporter for too long.

Feel free to reopen it if necessary.

Thank you.
Comment 6 hwoarang 2006-03-01 02:10:45 UTC
Comment 7 mr_than 2006-08-07 04:43:58 UTC
I've tracked the problem down to the xTableRows.insertByIndex method. It now
requires two longs as it's arguments, but I think it must have taken two ints in
the past.

The documentation
now says two longs, but it will not compile against recent builds (currently
608_b180) but is still OK on the 2.0 release version.

I've tried this in Jdeveloper and now Eclipse and both show the same in content
assist (ints) and neither will compile it with longs.

If I run it with ints, OpenOffice gives the same fatal error.
Comment 8 mr_than 2006-08-07 04:52:27 UTC
This is on Windows XP BTW
Comment 9 mr_than 2006-10-10 01:16:17 UTC
issue 59143 also shows an error with this API
Comment 10 Rob Weir 2013-07-30 02:14:57 UTC
Reset assignee on issues not touched by assignee in more than 2000 days.