Package ag.ion.bion.officelayer.text

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


      IPageStyleProperties pageStyleProperties = pageStyle
          .getProperties();
      boolean value = pageStyleProperties.getIsLandscape();
      Assert.assertEquals(false, value);

      ITextTable textTable = textDocument.getTextTableService()
          .constructTextTable(5, 15);
      textDocument.getTextService().getTextContentService()
          .insertTextContent(textTable);
      page = pageService.getPage(0);
      pageStyle = page.getPageStyle();
View Full Code Here


      localOfficeApplication.activate();
      ITextDocument textDocument = (ITextDocument) localOfficeApplication
          .getDocumentService().constructNewDocument(
              IDocument.WRITER, new DocumentDescriptor());

      ITextTable textTable = textDocument.getTextTableService()
          .constructTextTable(5, 15);
      textDocument.getTextService().getTextContentService()
          .insertTextContent(textTable);

      ITextTableProperties tableProperties = textTable.getProperties();
      tableProperties.getCellWidths();

    } catch (Exception exception) {
      exception.printStackTrace();
      Assert.fail();
View Full Code Here

   * @date 17.03.2006
   */
  public static void constructAndFillTable(ITextDocument textDocument) {
    try {
      // create the table
      ITextTable textTable = textDocument.getTextTableService().constructTextTable(3, 5);       
      textDocument.getTextService().getTextContentService().insertTextContent(textTable);
   
      // and place some double values in it     
      textTable.getCell(0,0).setValue(12412);
      textTable.getCell(0,1).setValue(4444444);
     
      // to place text in a cell we need the text service of the individual cell.
      ITextService textService = textTable.getCell(0,2).getTextService();
      IText cellText = textService.getText();
      cellText.setText("Hello World!");
     
      // so now that we have seen it in detail, there is no problem in doing
      // it the short way.
      textTable.getCell(2,2).getTextService().getText().setText("A");
      textTable.getCell(3,2).getTextService().getText().setText("Simple");
      textTable.getCell(4,2).getTextService().getText().setText("Test");
     
    }
    catch (TextException exception) {
      exception.printStackTrace();
    }
View Full Code Here

   * @date 17.03.2006
   */
  public static void constructAndFillTables(ITextDocument textDocument) {
    try {
      // create the first table
      ITextTable textTable = textDocument.getTextTableService().constructTextTable(3, 5);       
      textDocument.getTextService().getTextContentService().insertTextContent(textTable);
   
      int tableRowCount = textTable.getRowCount();
      int tableColumnCount = textTable.getColumnCount();
     
      int counter=0; // just to fill some value inside the cells
     
      // we will just fill it with double values
      for(int i=0;i<tableRowCount;i++) {
        for(int j=0;j<tableColumnCount;j++) {
          textTable.getCell(j,i).setValue(++counter);
        }
      }
     
      // add a new row at the end of the table
      textTable.addRow(1);
     
      ITextTableRow row = textTable.getRow(textTable.getRowCount()-1);
      ITextTableColumn[] columns = textTable.getColumns();
      // we want the sum of each column in the last row
      for(int i=0;i<columns.length;i++) {
        ITextTableCell[][] cells = columns[i].getCellRange().getCells();
       
        //we need all but the last cell in the column (the last will be the formula)       
View Full Code Here

      ITextDocument textDocument = (ITextDocument)documentService.constructNewDocument(IDocument.WRITER, DocumentDescriptor.DEFAULT);

      //construct table
      int rows = 15;
      int cols = 5;
      ITextTable textTable = textDocument.getTextTableService().constructTextTable(rows, cols);      
      textDocument.getTextService().getTextContentService().insertTextContent(textTable);
      textTable.setHeaderRows(3);
      //set some text
      for(int i = 0, n = rows; i < n; i++) {
        for(int j = 0, m = cols; j < m; j++) {
          IText cellText = textTable.getCell(j,i).getTextService().getText();
          cellText.setText("Line "+(i+1)+" Col "+(j+1));
        }
      }
    }
    catch (Throwable exception) {
View Full Code Here

   * @date 17.03.2006
   */
  public static void constructAndFillTables(ITextDocument textDocument) {
    try {
      // create the first table
      ITextTable firstTextTable = textDocument.getTextTableService().constructTextTable(3, 5);       
      textDocument.getTextService().getTextContentService().insertTextContent(firstTextTable);
   
      int firstTableRowCount = firstTextTable.getRowCount();
      int firstTableColumnCount = firstTextTable.getColumnCount();
     
      int counter=0; // just to fill some value inside the cells
     
      // we will just fill it with double values
      for(int i=0;i<firstTableRowCount;i++) {
        for(int j=0;j<firstTableColumnCount;j++) {
          firstTextTable.getCell(j,i).setValue(++counter);
        }
      }
     
      // create the second table
      ITextTable secondTextTable = textDocument.getTextTableService().constructTextTable(4, 4);       
      textDocument.getTextService().getTextContentService().insertTextContent(secondTextTable);
      ITextTableRow[] rows = secondTextTable.getRows();
     
      // we will iterate through it in a different manner than before
      for(int i=0;i<rows.length;i++) {
        ITextTableRow currentRow = rows[i];
        ITextTableCell[] cellsOfRow = currentRow.getCells();
        for(int j=0;j<cellsOfRow.length;j++) {
          String cellContent = "Column: " + (j+1) + " Row: " + (i+1);
          //that which follows is alrady known from Snippet3
          cellsOfRow[j].getTextService().getText().setText(cellContent);
        }
      }
     
      // add two new rows at the end of the table
      secondTextTable.addRow(2);
     
      // add a new row after the second row
      secondTextTable.addRow(2,1);
                 
    }
    catch (TextException exception) {
      exception.printStackTrace();
    }
View Full Code Here

      if (position.getType() != null && ITextRange.class.isAssignableFrom(position.getType())) {
        range = (ITextRange)position.getDestinationObject();
      }
      ITextDocument textDocument = textTable.getTextDocument();
      ITextContentService textContentService = textDocument.getTextService().getTextContentService();
      ITextTable newTable = textDocument.getTextTableService().constructTextTable(tablePropertyStore.getRows(), tablePropertyStore.getColumns());
           
      if (range != null) {
        textContentService.insertTextContent(range,newTable);
      }
      else {
        textContentService.insertTextContentAfter(newTable,textTable);
       }
     
      String[] propertyKeysToCopy = null;     
      if(propertyKeysContainer != null) {
        propertyKeysToCopy = propertyKeysContainer.getPropertyKeys(ITextTableProperties.TYPE_ID);       
      }
      else {
        //use default
        propertyKeysToCopy = TextTableProperties.getDefaultPropertyKeys();
      }
      if(propertyKeysToCopy != null) {
        ITextTableProperties newTableProperties = newTable.getProperties();
        ((IPropertyStore)tablePropertyStore).getProperties().copyTo(propertyKeysToCopy, newTableProperties);
      }
     
      int rowArrayLength = cellCloneServices.length;
      for (int rows = 0; rows < rowArrayLength; rows++) {
        //set row height
        newTable.getRow(rows).setHeight(textTable.getRow(rows).getHeight());
        newTable.getRow(rows).setAutoHeight(textTable.getRow(rows).getAutoHeight());
       
        int columnArrayLength = cellCloneServices[rows].length;
        for (int columns = 0; columns < columnArrayLength ; columns++) {
          ICloneService cellClone = cellCloneServices[rows][columns];
          ITextTableCell textTableCell = newTable.getCell(columns, rows);
          CloneDestinationPosition destinationCell = new CloneDestinationPosition(textTableCell, textTableCell.getClass());
          cellClone.cloneToPositionNoReturn(destinationCell, adoptContent,propertyKeysContainer);               
        }
      }
     
      if (createSpace) {
        IParagraph paragraph = textContentService.constructNewParagraph();
        textContentService.insertTextContentBefore(paragraph,newTable);
      }
      if(generateReturnValue)
        return new ClonedObject(newTable, newTable.getClass());
      else
        return null;
    }
    catch (Exception exception) {
      CloneException cloneException = new CloneException(exception.getMessage());
View Full Code Here

    ArrayList textTableCellRanges = new ArrayList();
    if(firstTableNumber == lastTableNumber) {
      textTableCellRanges.add(textTableManagement.getTextTable(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()];
    tableCellRanges = (ITextTableCellRange[])textTableCellRanges.toArray(tableCellRanges);
    ITextTableCellRangeName tableCellRangeName = new TextTableCellRangeName(firstColumnIndex,firstRowIndex,lastColumnIndex,lastRowIndex);
    IETextTableCellRange tableCellRange = new ETextTableCellRange(tableCellRanges,tableCellRangeName,this);
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

  public IETextTableColumn[] getColumns() throws TextException{
    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;
    }
    return null;
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.