/**
   * Tests boTableInit and boTableRowPopulate
   *
   * @throws Exception
   */
  public void testBoTableInit() throws Exception {
    AbstractDocument doc = new OpenOfficeDocument();
    try {
      String strGroup = "*";
      ZXBO objBO = zx.createBO("test/test");
      objBO.setPKValue("12");
      objBO.loadBO();

      assertEquals("Activate Openoffice", zXType.rc.rcOK.pos, doc.activate().pos);
      assertEquals("Open test document", zXType.rc.rcOK.pos, doc.openDoc("c:/tmp/test.doc").pos);

      /** Get the placeholder table. */
      Object objTable = doc.getTable(1, 1, zXType.wordSection.wsPage);
      assertEquals(
          "Setup the table", zXType.rc.rcOK.pos, doc.boTableInit(objTable, objBO, strGroup).pos);

      objTable = doc.getTable(1, 1, zXType.wordSection.wsPage);
      XTextTable xTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, objTable);
      XCellRange objRow = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTable);
      objRow = objRow.getCellRangeByName("A2:C2");

      assertEquals(
          "Populate table row.",
          zXType.rc.rcOK.pos,
          doc.boTableRowPopulate(objRow, objBO, strGroup).pos);

    } finally {
      assertEquals("Close document", zXType.rc.rcOK.pos, doc.closeDoc(false).pos);
    }
  }
  /** Test new Doc */
  public void testOpenDoc() {
    AbstractDocument doc = new OpenOfficeDocument();
    try {

      assertEquals("Activate Openoffice", zXType.rc.rcOK.pos, doc.activate().pos);
      assertEquals(
          "Create new blank document", zXType.rc.rcOK.pos, doc.openDoc("c:/tmp/test.doc").pos);

    } finally {
      assertEquals("Close document", zXType.rc.rcOK.pos, doc.closeDoc(false).pos);
    }
  }
  /** Tests addTableRow */
  public void testAddTableRow() {
    AbstractDocument doc = new OpenOfficeDocument();
    try {

      assertEquals("Activate Openoffice", zXType.rc.rcOK.pos, doc.activate().pos);
      assertEquals("Open test document", zXType.rc.rcOK.pos, doc.openDoc("c:/tmp/test.doc").pos);
      Object objTable = doc.getTable(1, 1, zXType.wordSection.wsPage);
      assertEquals("Add row to table", zXType.rc.rcOK.pos, doc.addTableRow(objTable).pos);

    } finally {
      assertEquals("Close document", zXType.rc.rcOK.pos, doc.closeDoc(false).pos);
    }
  }
  /** Tests populateTableCell */
  public void testPopulateTableCell() {
    AbstractDocument doc = new OpenOfficeDocument();
    try {

      assertEquals("Activate Openoffice", zXType.rc.rcOK.pos, doc.activate().pos);
      assertEquals("Open test document", zXType.rc.rcOK.pos, doc.openDoc("c:/tmp/test.doc").pos);
      Object objTable = doc.getTable(1, 1, zXType.wordSection.wsPage);
      assertEquals(
          "Populate table cell",
          zXType.rc.rcOK.pos,
          doc.populateTableCell(objTable, 1, 1, "(GONE)").pos);

    } finally {
      assertEquals("Close document", zXType.rc.rcOK.pos, doc.closeDoc(false).pos);
    }
  }
  /** Test new Doc */
  public void testSaveDocAs() {
    AbstractDocument doc = new OpenOfficeDocument();
    try {

      assertEquals("Activate Openoffice", zXType.rc.rcOK.pos, doc.activate().pos);
      assertEquals("Open document", zXType.rc.rcOK.pos, doc.openDoc("c:/tmp/test.doc").pos);

      Object objTable = doc.getTable(1, 1, zXType.wordSection.wsPage);
      assertEquals(
          "Set table cell",
          zXType.rc.rcOK.pos,
          doc.setTableCell(objTable, 1, 1, "Hello World!!!").pos);

      assertEquals("Save as", zXType.rc.rcOK.pos, doc.saveDocAs("c:/tmp/test.pdf").pos);

    } finally {
      assertEquals("Close document", zXType.rc.rcOK.pos, doc.closeDoc(false).pos);
    }
  }