Package de.filiadata.lucene.spider.generated.msoffice2000.word

Examples of de.filiadata.lucene.spider.generated.msoffice2000.word.Section


      // COM-Thread initialisieren
      ComThread.InitSTA();

      // Neue Word-Applikation erstellen
      mLog.info("Starting MS Word");
      mWordApplication = new Application();

      // Word unsichtbar machen
      // mWordApplication.setVisible(false);
      Dispatch.put(mWordApplication, "Visible", new Variant(false));
    }
View Full Code Here


      //             jedem Fall (auch bei file-Dokumenten) anstatt der
      //             Originaldatei eine tempor�re Kopie genutzt, da diese
      //             unm�glich von jemandem bearbeitet werden kann.
      String fileName = rawDocument.getContentAsFile(true).getAbsolutePath();
      Documents docs = mWordApplication.getDocuments();
      Document doc = docs.open(new Variant(fileName),
                               new Variant(false),    // confirmConversions
                               new Variant(true));    // readOnly

      // iterate through the sections
      StringBuffer content = new StringBuffer(DEFAULT_BUFFER_SIZE);
      Sections sections = doc.getSections();
      for (int i = 1; i <= sections.getCount(); i++) {
        Section sec = sections.item(i);

        // Get the header of the first section as title
        if (i == 1) {
          int headerFirstPage = WdHeaderFooterIndex.wdHeaderFooterFirstPage;
          HeaderFooter firstHeader = sec.getHeaders().item(headerFirstPage);
          String title = firstHeader.getRange().getText();
          setTitle(title);
        }

        // Get the text
        sec.getRange().select();
        content.append(getSelection(mWordApplication) + "\n");
      }

      // iterate through the shapes
      Shapes shapes = doc.getShapes();
      for (int i = 1; i <= shapes.getCount(); i++) {
        Shape shape = shapes.item(new Variant(i));
        appendShape(shape, content);
      }
     
      // iterate through the paragraphs and extract the headlines
      StringBuffer headlines = null;
      if ((mHeadlineStyleNameSet != null) && (! mHeadlineStyleNameSet.isEmpty())) {
        Paragraphs paragraphs = doc.getParagraphs();
        for (int i = 1; i <= paragraphs.getCount(); i++) {
          Paragraph paragraph = paragraphs.item(i);
         
          // Get the name of the style for this paragraph
          // NOTE: See the Style class for getting other values from the style
          Object styleDispatch = paragraph.getFormat().getStyle().getDispatch();
          String formatName = Dispatch.get(styleDispatch, "NameLocal").toString();
         
          if (mHeadlineStyleNameSet.contains(formatName)) {
            // This paragraph is a headline -> add it to the headlines StringBuffer
           
            // Extract the text
            paragraph.getRange().select();
            String text = getSelection(mWordApplication);
            text = removeBinaryStuff(text);
           
            // Add it to the headlines
            if (headlines == null) {
              headlines = new StringBuffer();
            }
            headlines.append(text + "\n");
           
            if (mLog.isDebugEnabled()) {
              mLog.debug("Extracted headline: '" + text + "'");
            }
          }
        }
      }
     
      // Read the document properties
      readProperties(doc);
     
      // Set the extracted text and the headlines
      setCleanedContent(content.toString());
      if (headlines != null) {
        setHeadlines(headlines.toString());
      }

      // Dokument schlie�en (ohne Speichern)
      doc.close(new Variant(false));
    }
    catch (ComFailException exc) {
      throw new RegainException("Using COM failed.", exc);
    }
  }
View Full Code Here

      //             dann erscheint ein Popup. Um das zu verhindern, wird in
      //             jedem Fall (auch bei file-Dokumenten) anstatt der
      //             Originaldatei eine tempor�re Kopie genutzt, da diese
      //             unm�glich von jemandem bearbeitet werden kann.
      String fileName = rawDocument.getContentAsFile(true).getAbsolutePath();
      Documents docs = mWordApplication.getDocuments();
      Document doc = docs.open(new Variant(fileName),
                               new Variant(false),    // confirmConversions
                               new Variant(true));    // readOnly

      // iterate through the sections
      StringBuffer content = new StringBuffer(DEFAULT_BUFFER_SIZE);
View Full Code Here

    if (shapeName.startsWith("Text Box ")) {
      shape.getTextFrame().getTextRange().select();
      buffer.append(getSelection(mWordApplication) + "\n");
    }
    else if (shapeName.startsWith("Group ")) {
      GroupShapes group = shape.getGroupItems();
      for (int i = 1; i <= group.getCount(); i++) {
        Shape child = group.item(new Variant(i));
        appendShape(child, buffer);
      }
    }
  }
View Full Code Here

        Section sec = sections.item(i);

        // Get the header of the first section as title
        if (i == 1) {
          int headerFirstPage = WdHeaderFooterIndex.wdHeaderFooterFirstPage;
          HeaderFooter firstHeader = sec.getHeaders().item(headerFirstPage);
          String title = firstHeader.getRange().getText();
          setTitle(title);
        }

        // Get the text
        sec.getRange().select();
View Full Code Here

      // iterate through the paragraphs and extract the headlines
      StringBuffer headlines = null;
      if ((mHeadlineStyleNameSet != null) && (! mHeadlineStyleNameSet.isEmpty())) {
        Paragraphs paragraphs = doc.getParagraphs();
        for (int i = 1; i <= paragraphs.getCount(); i++) {
          Paragraph paragraph = paragraphs.item(i);
         
          // Get the name of the style for this paragraph
          // NOTE: See the Style class for getting other values from the style
          Object styleDispatch = paragraph.getFormat().getStyle().getDispatch();
          String formatName = Dispatch.get(styleDispatch, "NameLocal").toString();
         
          if (mHeadlineStyleNameSet.contains(formatName)) {
            // This paragraph is a headline -> add it to the headlines StringBuffer
           
            // Extract the text
            paragraph.getRange().select();
            String text = getSelection(mWordApplication);
            text = removeBinaryStuff(text);
           
            // Add it to the headlines
            if (headlines == null) {
View Full Code Here

      }
     
      // iterate through the paragraphs and extract the headlines
      StringBuffer headlines = null;
      if ((mHeadlineStyleNameSet != null) && (! mHeadlineStyleNameSet.isEmpty())) {
        Paragraphs paragraphs = doc.getParagraphs();
        for (int i = 1; i <= paragraphs.getCount(); i++) {
          Paragraph paragraph = paragraphs.item(i);
         
          // Get the name of the style for this paragraph
          // NOTE: See the Style class for getting other values from the style
          Object styleDispatch = paragraph.getFormat().getStyle().getDispatch();
          String formatName = Dispatch.get(styleDispatch, "NameLocal").toString();
View Full Code Here

      // iterate through the sections
      StringBuffer content = new StringBuffer(DEFAULT_BUFFER_SIZE);
      Sections sections = doc.getSections();
      for (int i = 1; i <= sections.getCount(); i++) {
        Section sec = sections.item(i);

        // Get the header of the first section as title
        if (i == 1) {
          int headerFirstPage = WdHeaderFooterIndex.wdHeaderFooterFirstPage;
          HeaderFooter firstHeader = sec.getHeaders().item(headerFirstPage);
          String title = firstHeader.getRange().getText();
          setTitle(title);
        }

        // Get the text
        sec.getRange().select();
        content.append(getSelection(mWordApplication) + "\n");
      }

      // iterate through the shapes
      Shapes shapes = doc.getShapes();
View Full Code Here

                               new Variant(false),    // confirmConversions
                               new Variant(true));    // readOnly

      // iterate through the sections
      StringBuffer content = new StringBuffer(DEFAULT_BUFFER_SIZE);
      Sections sections = doc.getSections();
      for (int i = 1; i <= sections.getCount(); i++) {
        Section sec = sections.item(i);

        // Get the header of the first section as title
        if (i == 1) {
          int headerFirstPage = WdHeaderFooterIndex.wdHeaderFooterFirstPage;
          HeaderFooter firstHeader = sec.getHeaders().item(headerFirstPage);
View Full Code Here

   *
   * @param wordAppl The Word application to get the selected text from.
   * @return The currently selected text.
   */
  private String getSelection(Application wordAppl) {
    Selection sel = wordAppl.getSelection();
    // Alternative (VB): sel.moveEndWhile(?? cset:=vbCr ??, WdConstants.wdBackward);
    // Alternative (VB): Call app.ActiveDocument.Bookmarks.Item("\endofdoc").Select()
    sel.moveEnd();
    sel.copy();
    return sel.getText();
  }
View Full Code Here

TOP

Related Classes of de.filiadata.lucene.spider.generated.msoffice2000.word.Section

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.