Package ag.ion.bion.officelayer.text

Examples of ag.ion.bion.officelayer.text.ITextTable


   *
   * @author Miriam Sutter
   */
  public void removeTextTable(int index, ITextDocument textDocument)
      throws TextException {
    ITextTable textTable = (ITextTable) textTablesByIndex.get(index);
    textTable.remove();
    textTablesByIndex.remove(index);
    textTablesByName.remove(textTable.getName());
  }
View Full Code Here


      boolean adoptContent, boolean generateReturnValue,
      PropertyKeysContainer propertyKeysContainer) throws CloneException {
    try {
      if (cellCloneServices == null)
        getCloneCells();
      ITextTable newTable = null;
      if (oldTable == null)
        oldTable = textTableCellRange.getCell(0, 0).getTextTable();
      if (textTablePropertyStore == null) {
        textTablePropertyStore = oldTable.getPropertyStore();
      }
      int columnStart = 0;
      int rowStart = 0;
      if (cellCloneServices.length == 0) {
        CloneException cloneException = new CloneException(
            "No range selected.");
        throw cloneException;
      }
      int columnArrayLength = cellCloneServices[0].length;

      if (position.getType() == null) {
        CloneException cloneException = new CloneException(
            "No valid type for the position.");
        throw cloneException;
      }

      if (ITextRange.class.isAssignableFrom(position.getType())) {
        ITextRange range = (ITextRange) position.getDestinationObject();
        if (textTableService == null)
          textTableService = textDocument.getTextTableService();
        newTable = (ITextTable) textTableService.constructTextTable(
            rowCount, columnCount);
        newTable.getProperties().setRepeatHeadline(
            textTablePropertyStore.repeatHeadline());
        if (textContentService == null)
          textContentService = textDocument.getTextService()
              .getTextContentService();
        if (range != null) {
          textContentService.insertTextContent(range, newTable);
          newTable.getProperties().setTableColumnSeparators(
              textTablePropertyStore.getTableColumnSeparators());
        } else {
          CloneException cloneException = new CloneException(
              "No destination selected..");
          throw cloneException;
        }
      } else if (ITextTable.class.isAssignableFrom(position.getType())) {
        ITextTable range = (ITextTable) position.getDestinationObject();
        TextTableService tableService = new TextTableService(
            textDocument);

        newTable = (ITextTable) tableService.constructTextTable(
            rowCount, columnCount);
View Full Code Here

   * @author Markus Kr�ger
   */
  private void addRowsProperty(int count,
      ITextTableCellRange textTableCellRangeClone) throws TextException {
    try {
      ITextTable textTableLast = textTableManagement.getLastTextTable();
      int singleTableRowCount = textTableLast.getRowCount();
      if ((singleTableRowCount + count) * columnCount <= ITextTable.MAX_CELLS_IN_TABLE) {
        textTableLast.addRow(count);
      } else {
        ITextTableCellRange textTableCellRangeHeaderClone = textTableLast
            .getCellRange(0, 0, columnCount - 1, 0);
        int helpRows = maxRowsInTable - singleTableRowCount;
        if (helpRows > 0) {
          textTableLast.addRow(helpRows);
        }
        int helpCount = count - helpRows;
        while (helpCount > 0) {
          int insert = helpCount;
          TextTablePropertyStore tablePropertyStore = new TextTablePropertyStore(
              textTableManagement.getFirstTextTable());
          if (tablePropertyStore.repeatHeadline()) {
            insert = insert + 1;
          }
          if (helpCount * columnCount > ITextTable.MAX_CELLS_IN_TABLE) {
            insert = maxRowsInTable;
          }
          ITextTable textTable = textDocument.getTextTableService()
              .constructTextTable(1, columnCount);
          ITextTableProperties properties = textTable.getProperties();
          properties.setRepeatHeadline(tablePropertyStore
              .repeatHeadline());
          textDocument.getTextService().getTextContentService()
              .insertTextContentAfter(textTable, textTableLast);
          properties.setTableColumnSeparators(tablePropertyStore
              .getTableColumnSeparators());
          IDestinationPosition destinationPosition = new DestinationPosition(
              textTable.getCell("A1"));
          if (tablePropertyStore.repeatHeadline()) {
            textTableCellRangeHeaderClone.getCloneService()
                .cloneToPositionNoReturn(destinationPosition,
                    null);
            destinationPosition = new DestinationPosition(textTable
                .getCell("A2"));
            textTableCellRangeClone.getCloneService()
                .cloneToPositionNoReturn(destinationPosition,
                    false, null);
          } else {
            textTableCellRangeClone.getCloneService()
                .cloneToPositionNoReturn(destinationPosition,
                    false, null);
          }
          textTable.addRow(insert - 1);
          textTableManagement.addTextTable(textTable);
          helpCount = helpCount - insert;
        }
      }
    } catch (Exception exception) {
View Full Code Here

      textTableManagement.getFirstTextTable().addRow(index, count);
      return;
    }
    IETextTableCellRange textTableCellRange = getCellRange(0, index,
        columnCount - 1, getRowCount() - 1);
    ITextTable textTable = textTableManagement.getLastTextTable();
    IDestinationPosition destinationPosition = new DestinationPosition(
        textTable);

    try {
      ETextTableCellRange tableCellRange = (ETextTableCellRange) textTableCellRange
          .getCloneService().cloneToPosition(destinationPosition,
              null).getClonedObject();
      ITextTableCellRange[] textTableCellRanges = tableCellRange
          .getRanges();
      int tableNumber = getTableNumber(index);
      ITextTable table = textTableManagement.getTextTable(tableNumber);

      int rowCount = table.getRowCount() - 1;
      int rowIndex = getRowIndexInTable(tableNumber, index);

      removeTables(tableNumber + 1,
          textTableManagement.getTextTables().length - tableNumber
              - 1);

      ITextTableCellRange textTableCellRangeClone = table.getCellRange(0,
          rowIndex, columnCount - 1, rowIndex);

      int help = rowIndex + count - (rowCount + 1);
      if (help < 0) {
        for (int i = rowIndex; i <= count; i++) {
          ITextTableCellRange cellRange = table.getCellRange(0, i,
              columnCount - 1, i);
          destinationPosition = new DestinationPosition(cellRange);
          textTableCellRangeClone.getCloneService().cloneToPosition(
              destinationPosition, null);
        }
        IETextTableCellRange cellRange = getCellRange(0, index,
            columnCount - 1, index + count - 1);
        clearTableRange(cellRange);
        table.removeRows(rowIndex + count, rowCount
            - (rowIndex + count) + 1);
      } else {
        for (int i = rowIndex; i <= rowCount; i++) {
          ITextTableCellRange cellRange = table.getCellRange(0, i,
              columnCount - 1, i);
          destinationPosition = new DestinationPosition(cellRange);
          textTableCellRangeClone.getCloneService().cloneToPosition(
              destinationPosition, null);
        }
View Full Code Here

          firstTableNumber).getCellRange(firstColumnIndex,
          getRowIndexInTable(firstTableNumber, firstRowIndex),
          lastColumnIndex,
          getRowIndexInTable(firstTableNumber, lastRowIndex)));
    } else {
      ITextTable textTable = textTableManagement
          .getTextTable(firstTableNumber);
      textTableCellRanges.add(textTable.getCellRange(firstColumnIndex,
          getRowIndexInTable(firstTableNumber, firstRowIndex),
          lastColumnIndex, textTable.getRowCount() - 1));
      for (int i = firstTableNumber + 1; i < lastTableNumber; i++) {
        textTable = textTableManagement.getTextTable(i);
        textTableCellRanges.add(textTable.getCellRange(
            firstColumnIndex, 0, lastColumnIndex, textTable
                .getRowCount() - 1));
      }
      textTable = textTableManagement.getTextTable(lastTableNumber);
      textTableCellRanges.add(textTable.getCellRange(firstColumnIndex, 0,
          lastColumnIndex, getRowIndexInTable(lastTableNumber,
              lastRowIndex)));
    }
    ITextTableCellRange[] tableCellRanges = new ITextTableCellRange[textTableCellRanges
        .size()];
View Full Code Here

  public IETextTableColumn getColumn(int columnIndex) throws TextException {
    ITextTable[] textTables = textTableManagement.getTextTables();
    if (textTables.length > 0) {
      ETextTableColumn textTableColumn = new ETextTableColumn(this);
      for (int j = 0; j < textTables.length; j++) {
        ITextTable textTable = textTables[j];
        if (textTableColumn == null) {
          textTableColumn = new ETextTableColumn(this);
        }
        textTableColumn.addTextTableColum(textTable
            .getColumn(columnIndex));
      }
      return textTableColumn;
    }
    return null;
View Full Code Here

    ITextTable[] textTables = textTableManagement.getTextTables();
    if (textTables.length > 0) {
      ETextTableColumn[] textTableColumns = new ETextTableColumn[textTables[0]
          .getColumnCount()];
      for (int j = 0; j < textTables.length; j++) {
        ITextTable textTable = textTables[j];
        for (int i = 0; i < textTable.getColumnCount(); i++) {
          if (textTableColumns[i] == null) {
            textTableColumns[i] = new ETextTableColumn(this);
          }
          textTableColumns[i].addTextTableColum(textTable
              .getColumn(i));
        }
      }
      return textTableColumns;
    }
View Full Code Here

      docu = (ITextDocument) officeApplication
          .getDocumentService()
          .loadDocument(
              "file:///d:/java/eclipse/workspace/officeapi/test/testETables.sxw");

      ITextTable table = docu.getTextTableService().getTextTables()[0];
      ETextTable textTable = new ETextTable(docu, table);

      textTable.addRows(200); // o.k.

      textTable.getCell(10, 1).setCellFormula("<A100>+<B3>");
View Full Code Here

  private IClonedObject clonePreprocessor(IDestinationPosition position,
      boolean adoptContent, boolean generateReturnValue,
      PropertyKeysContainer propertyKeysContainer) throws CloneException {
    ITextTable[] textTables = textTable.getTextTableManagement()
        .getTextTables();
    ITextTable table = (ITextTable) textTables[0].getCloneService()
        .cloneToPosition(position, adoptContent, propertyKeysContainer)
        .getClonedObject();
    ETextTable eTextTable = new ETextTable(textDocument, table);

    for (int i = 1; i < textTables.length; i++) {
View Full Code Here

          .getRanges();
      ITextTableCellRange[] range = new ITextTableCellRange[textTableCellRanges.length];
      range[0] = (ITextTableCellRange) textTableCellRanges[0]
          .getCloneService().cloneToPosition(position, adoptContent,
              propertyKeysContainer).getClonedObject();
      ITextTable table = range[0].getCell(0, 0).getTextTable();
      ETextTable eTextTable = new ETextTable(textDocument, table);
      for (int i = 1; i < textTableCellRanges.length; i++) {
        IDestinationPosition destinationPosition = new DestinationPosition(
            table);
        range[i] = (ITextTableCellRange) textTableCellRanges[i]
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.text.ITextTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.