Package ag.ion.bion.officelayer.text

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


      IOfficeApplication officeApplication = OfficeApplicationRuntime
          .getApplication(hashMap);
      officeApplication.activate();

      System.out.println("Constructing a new writer document ...");
      ITextDocument textDocument = (ITextDocument) officeApplication
          .getDocumentService()
          .constructNewDocument(IDocument.WRITER,
              DocumentDescriptor.DEFAULT_HIDDEN);
      System.out
          .println("Inserting text into the new writer document ...");
      textDocument.getTextService().getText().setText(
          "This is a NOA test.");
      System.out.println("Storing new writer document ...");
      textDocument.getPersistenceService().store(
          new FileOutputStream("noatest.odt"));
      textDocument.close();
      officeApplication.deactivate();

    } catch (Throwable throwable) {
      throwable.printStackTrace();
    }
View Full Code Here


   */
  public short compareRange(ITextRange textRangeToCompare) throws TextException {
    try {
      ITextRange thisCompareRange = this;
      if(document instanceof ITextDocument) {
        ITextDocument textDocument = (ITextDocument)document;
        ITextTableCell thisCompareRangeCell = thisCompareRange.getCell();
        ITextTableCell textRangeToCompareCell = textRangeToCompare.getCell();
        if(thisCompareRangeCell != null && textRangeToCompareCell == null) {
          XTextContent textTable = thisCompareRangeCell.getTextTable().getXTextContent();  
          XSelectionSupplier selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
          selectionSupplier.select(textTable);
          XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
          xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
          thisCompareRange = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
        }
        else if(textRangeToCompareCell != null && thisCompareRangeCell == null) {
          XTextContent textTable = textRangeToCompareCell.getTextTable().getXTextContent();  
          XSelectionSupplier selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
          selectionSupplier.select(textTable);
          XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
          xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
          textRangeToCompare = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
        }
        else if(thisCompareRangeCell != null && textRangeToCompareCell != null) {
          XTextContent thisCompareRangeTable = thisCompareRangeCell.getTextTable().getXTextContent();
          XTextContent textRangeToCompareTable = textRangeToCompareCell.getTextTable().getXTextContent();
          boolean sameTable = UnoRuntime.areSame(
              thisCompareRangeTable,textRangeToCompareTable);
          if(sameTable) {
            ITextTableCellName thisCompareRangeCellName = thisCompareRangeCell.getName();
            ITextTableCellName textRangeToCompareCellName = textRangeToCompareCell.getName();
            int thisCompareRangeCellRow = thisCompareRangeCellName.getRowIndex();
            int thisCompareRangeCellCol = thisCompareRangeCellName.getColumnIndex();
            int textRangeToCompareCellRow = textRangeToCompareCellName.getRowIndex();
            int textRangeToCompareCellCol = textRangeToCompareCellName.getColumnIndex();
            if(thisCompareRangeCellRow < textRangeToCompareCellRow)
              return 1;
            else if(thisCompareRangeCellRow > textRangeToCompareCellRow)
              return -1;
            else {
              if(thisCompareRangeCellCol < textRangeToCompareCellCol)
                return 1;
              else if(thisCompareRangeCellCol > textRangeToCompareCellCol)
                return -1;
            }
          }
          else {
            XSelectionSupplier selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
            selectionSupplier.select(thisCompareRangeTable);
            XTextViewCursorSupplier xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
            xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
            thisCompareRange = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
            
            selectionSupplier = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, textDocument.getXTextDocument().getCurrentController());
            selectionSupplier.select(textRangeToCompareTable);
            xTextViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, textDocument.getXTextDocument().getCurrentController());
            xTextViewCursorSupplier.getViewCursor().goLeft((short)1,false);
            textRangeToCompare = textDocument.getViewCursorService().getViewCursor().getTextCursorFromEnd().getEnd();
          }
        }
      }
      XText text = thisCompareRange.getXTextRange().getText();   
      XTextRangeCompare comparator = (XTextRangeCompare) UnoRuntime.queryInterface(XTextRangeCompare.class, text);
View Full Code Here

   * @author Sebastian R�sgen
   * @author Markus Kr�ger
   */
  public void markTextField() {   
    try {
      ITextDocument textDocument = getTextDocument();
      textDocument.setSelection(new TextRangeSelection(getTextRange()));
     
     
      /*XTextDocument xTextDocument= getTextDocument().getXTextDocument();
      Object master1 = xDependentTextField.getTextFieldMaster();
      XText anchorText = xDependentTextField.getAnchor().getText();
View Full Code Here

  }

  @Override
  public String extractTag() {
    OODocument document = (OODocument) getTutorialDocument();
    ITextDocument textDocument = (ITextDocument) document.getDocument();
    ITextCursor textCursor = textDocument.getTextService()
        .getCursorService().getTextCursor();
    textCursor.gotoRange(textRange, false);
    return textCursor.getString();
  }
View Full Code Here

  }

  private String integrateInText(TextInfo textInfo,
      TextPosition position) {
    OODocument ooDocument = (OODocument) position.getTutorialDocument();
    ITextDocument textDocument = (ITextDocument) ooDocument.getDocument();
    ITextRange textRange = position.getTextRange();

    ITextContentService textContentService = textDocument.getTextService().getTextContentService();

    ITextDocumentTextShape textDocumentTextShape = null;
    try {
      textDocumentTextShape = textContentService.constructNewTextShape(textInfo);
      textContentService.insertTextContent(textRange, textDocumentTextShape);
View Full Code Here

  }

  private String integrateInText(GraphicInfo graphicInfo,
      TextPosition position) {
    OODocument ooDocument = (OODocument) position.getTutorialDocument();
    ITextDocument textDocument = (ITextDocument) ooDocument.getDocument();
    ITextRange textRange = position.getTextRange();

    ITextContentService textContentService = textDocument.getTextService()
        .getTextContentService();

    ITextDocumentImage textDocumentImage = null;
    try {
      textDocumentImage = textContentService
View Full Code Here

    ooApplication = new OOApplication();
  }

  @Test
  public void testWriter() throws NOAException, OfficeApplicationException {
    ITextDocument document = (ITextDocument) ooApplication
        .constructNewDocument(IDocument.WRITER);

    OODocument ooDocument = new OODocument(document, new EclipseFile(
        "tmp file")); //$NON-NLS-1$

    String tag = "<aTag/>"; //$NON-NLS-1$
    ConnectorMaster.getInstance().insertTagsIntoDocument(tag, ooDocument);

    String text = document.getTextService().getText().getText();
    Assert.assertEquals(tag, text);
  }
View Full Code Here

    app.activate();
  }
 
  public void testCreateDoc() {
    try {
      ITextDocument doc = (ITextDocument) app.getDocumentService().constructNewDocument(IDocument.WRITER, new DocumentDescriptor());
//      doc.getTextService().getText().setText("Ein temp Doc");
      File tmpDir = FileUtil.getTemporaryDirectory("OOtempTest");
      assertNotNull(tmpDir);
      tmpDir = FileUtil.makeUniqueDirectory(tmpDir);
      String fileName = "EinTest.odt";
      File tempFile = new File(tmpDir.getAbsolutePath() + File.separator + fileName);
      boolean created = tempFile.createNewFile();
      assertTrue(created);
      FileOutputStream fos = new FileOutputStream(tempFile);
      doc.getPersistenceService().store(fos);
    } catch (NOAException e) {
      e.printStackTrace();
    } catch (OfficeApplicationException e) {
      e.printStackTrace();
    } catch (FileNotFoundException e) {
View Full Code Here

public class ETextTableTest extends TestCase {

  public void testETextTable() {
    IOfficeApplication officeApplication = OfficeApplicationRuntime
        .getLocalOfficeApplication();
    ITextDocument docu = null;
    try {

      LocalOfficeApplicationConfiguration localOfficeApplicationConfiguration = new LocalOfficeApplicationConfiguration();
      localOfficeApplicationConfiguration.setPort("8101");
      localOfficeApplicationConfiguration
          .setApplicationHomePath("d:\\Programme\\OpenOffice.org1.1.3");
      officeApplication
          .setConfiguration(localOfficeApplicationConfiguration);
      officeApplication.activate();
      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>");
      textTable.getCell(10, 2).setCellFormula("<A100:A200>+<B3:B7>");
      // textTable.addRows(1,10); // o.k.
      // textTable.addRows(100,10); //o.k.
      // // textTable.addRows(1,82); // o.k.
      // // textTable.addRows(1,83); // o.k.
      // //
      // // textTable.addRows(100,82); // o.k.
      // //
      // textTable.addRows(1,220); // o.k.
      // textTable.addRows(100,220); // o.k.

      // IETextTableCellRange tableCellRange =
      // textTable.getCellRange(0,100,5,110);
      // Object[][] objects = tableCellRange.getData();
      // for(int i = 0; i < objects.length; i++) {
      // for(int j = 0; j < objects[i].length; j++) {
      // objects[i][j] = i + "/" + j;
      // }
      // }
      // tableCellRange.setData(objects);
      // System.out.println(textTable.getColumn(0).getCellRange().getRangeName().getRangeName());
      // System.out.println(textTable.getColumn(0).getCellRange().getCells()[0].getName().getName());;
      // System.out.println(textTable.getRow(7).getCellRange().getRangeName().getRangeName());
      // System.out.println(textTable.getRows()[7].getCellRange().getRangeName().getRangeName());
      // System.out.println(textTable.getCellRange(0,30,5,50).getRangeName().getRangeName());
      //       
      // System.out.println(textTable.getColumn(0).getCellRange().getRangeName().getRangeName());

      // System.out.println(textTable.getCellRange(0,30,5,150).getRangeName().getRangeName());
      // System.out.println(textTable.getCellRange(0,0,textTable.getColumnCount()-1,textTable.getRowCount()-1).getRangeName().getRangeName());
      // System.out.println(textTable.getColumn(0).getCellRange().getCell(0,200,textTable.getColumnCount()).getName().getName());
      // System.out.println(textTable.getColumn(0).getCellRange().getCell(0,125,textTable.getColumnCount()).getTableCell().getTextService().getText().getText());
      //       
      // ITextTable[] textTables =
      // textTable.getTextTableManagement().getTextTables();
      // for(int i = 0; i < textTables.length; i++) {
      // System.out.println(textTables[i].getName());
      // }
      docu.close();
    } catch (Exception excep) {
      try {
        docu.close();
        officeApplication.deactivate();
      } catch (Exception e) {
        fail();
      }
      fail();
View Full Code Here

      ITextRange range = null;
      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);
View Full Code Here

TOP

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

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.