Package ag.ion.bion.officelayer.text

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


      configuration
          .setApplicationHomePath("c:\\Programme\\OpenOffice.org1.1.3");
      localOfficeApplication.setConfiguration(configuration);
      localOfficeApplication.activate();

      ITextDocument textDocument = (ITextDocument) localOfficeApplication
          .getDocumentService().constructNewDocument(
              IDocument.WRITER, new DocumentDescriptor());
      IPageService pageService = textDocument.getPageService();
      IPage page = pageService.getPage(0);
      IPageStyle pageStyle = page.getPageStyle();
      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();
      pageStyleProperties = pageStyle.getProperties();
      value = pageStyleProperties.getIsLandscape();
View Full Code Here


            + TextTableCellNameHelper
                .getColumnCharacter(lastCellName)
            + TextTableCellNameHelper
                .getRowCounterValue(lastCellName);
        ITextTableCellRange cellRange = getCellRange(range);
        ITextDocument textDocument = getTextDocument();
        if (textDocument.isOpen()) {
          XCell cell = getXTextTable().getCellByName(firstCell);
          XPropertySet xPropertySet = (XPropertySet) UnoRuntime
              .queryInterface(XPropertySet.class, cell);
          if (xPropertySet != null) {
            Object value = xPropertySet
                .getPropertyValue("TextSection");
            boolean select = true;
            XTextSection xTextSection = (XTextSection) UnoRuntime
                .queryInterface(XTextSection.class, value);
            if (xTextSection != null) {
              XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime
                  .queryInterface(XPropertySet.class,
                      xTextSection);
              if (xTextSectionPropertySet != null) {
                Boolean visible = (Boolean) xTextSectionPropertySet
                    .getPropertyValue("IsVisible");
                select = visible.booleanValue();
              }
            }
            if (select)
              textDocument
                  .setSelection(new XInterfaceObjectSelection(
                      cellRange.getXCellRange()));
          }
        }
      }
View Full Code Here

              new FileInputStream(new File("test/testTexts.sxw")),
              new DocumentDescriptor());
      if (document != null) {
        System.out.println("Loaded document");

        ITextDocument textDocument = (ITextDocument) document;

        ITextContentEnumeration textEnumeration = textDocument
            .getTextService().getText().getTextContentEnumeration();
        IParagraph[] paragraphs = textEnumeration.getParagraphs();

        ITextRange newTextRange = textDocument.getViewCursorService()
            .getViewCursor().getStartTextRange();
        XTextCursor cursor = newTextRange.getXTextRange().getText()
            .createTextCursor();
        cursor.gotoEnd(false);
        newTextRange = new TextRange(textDocument, cursor);
        paragraphs[0].getCloneService().cloneToPosition(
            new CloneDestinationPosition(newTextRange, newTextRange
                .getClass()), true, null);

        textDocument.close();
        localOfficeApplication.deactivate();
      }
    } catch (Exception excep) {
      excep.printStackTrace();
    }
View Full Code Here

      LocalOfficeApplicationConfiguration configuration = new LocalOfficeApplicationConfiguration();
      configuration
          .setApplicationHomePath("d:\\Programme\\OpenOffice.org1.1.3");
      localOfficeApplication.setConfiguration(configuration);
      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();
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();
          }
        }
      }
View Full Code Here

      final IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration);
      officeAplication.setConfiguration(configuration);
      officeAplication.activate();
      IDocument document = officeAplication.getDocumentService().constructNewDocument(IDocument.WRITER,
          DocumentDescriptor.DEFAULT);
      ITextDocument textDocument = (ITextDocument) document;
      textDocument.getTextService().getText().setText("HalloWelt");
      textDocument.close();
      officeAplication.deactivate();
    }
    catch (Throwable exception) {
      exception.printStackTrace();
    }
View Full Code Here

    try {
      IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration);
      officeAplication.activate();
      IDocumentService documentService = officeAplication.getDocumentService();
      IDocument document = documentService.constructNewDocument(IDocument.WRITER, DocumentDescriptor.DEFAULT);
      ITextDocument textDocument = (ITextDocument)document;
      textDocument.addCloseListener(new SnippetDocumentCloseListener(officeAplication));
     
      /*
       * This stuff has already been discussed in Snippet2 but now lets begin to
       * work with tables in text documents
       */
 
View Full Code Here

      final IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration)
      officeAplication.setConfiguration(configuration);
      officeAplication.activate();
      IDocumentService documentService = officeAplication.getDocumentService();
      IDocument document = documentService.constructNewDocument(IDocument.WRITER, DocumentDescriptor.DEFAULT);
      ITextDocument textDocument = (ITextDocument)document;
     
      /*
       * Now do something with the textDocument ....
       * (Examples in other snippets)
       */
 
View Full Code Here

    try {
      IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration);
      officeAplication.activate();
      IDocumentService documentService = officeAplication.getDocumentService();
      IDocument document = documentService.constructNewDocument(IDocument.WRITER, DocumentDescriptor.DEFAULT);
      ITextDocument textDocument = (ITextDocument)document;
     
      /*
       * Now we just place some text in the document
       */
      textDocument.getTextService().getText().setText("Hello World Test Text");
     
      String temp = textDocument.getTextService().getText().getText();
      textDocument.getTextService().getText().setText(temp + "\n" + "Next Line in text")
     
      /*
       * This was very ugly so lets later see how this can be done better, with cursors
       * (Look on Snippet7 to learn more stuff about creating and working
       * with text in the dcoument)
View Full Code Here

  public List<IArtefactPosition> searchArtefactTags(OODocument ooDocument) {
    IDocument document = ooDocument.getDocument();
    if (!document.getDocumentType().equals(IDocument.WRITER))
      return null;

    ITextDocument textDocument = (ITextDocument) document;

    SearchDescriptor searchDescriptor = new SearchDescriptor(
        XMLArtefact.TAG_PATTERN);
    searchDescriptor.setIsCaseSensitive(false);
    searchDescriptor.setUseRegularExpression(true);
    ISearchResult searchResult = textDocument.getSearchService().findAll(
        searchDescriptor);

    List<IArtefactPosition> positions = new ArrayList<IArtefactPosition>();
    for (ITextRange textRange : searchResult.getTextRanges()) {
      OOArtefactPosition position = new TextPosition(ooDocument,
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.