Package ag.ion.bion.officelayer.application

Examples of ag.ion.bion.officelayer.application.IOfficeApplication


    HashMap hashMap = new HashMap(2);
    hashMap.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
    hashMap.put(IOfficeApplication.APPLICATION_HOME_KEY, officeHome);
   
    try {
      IOfficeApplication application = OfficeApplicationRuntime.getApplication(hashMap);
      application.activate();
      IDocument document = application.getDocumentService().constructNewHiddenDocument(IDocument.IMPRESS);
      document.getPersistenceService().export(pdfExportPath, PDFFilter.FILTER);
      application.deactivate();
    }
    catch(Throwable throwable) {
      throwable.printStackTrace();
    }
  }
View Full Code Here


      configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY,
          IOfficeApplication.REMOTE_APPLICATION);
      configuration.put(IOfficeApplication.APPLICATION_HOST_KEY, "host");
      configuration.put(IOfficeApplication.APPLICATION_PORT_KEY, "8100");

      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

     HashMap configuration = new HashMap();
    configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
    configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
   
    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));
     
      /*
 
View Full Code Here

  public static void main(String[] args) {
    try {
      HashMap configuration = new HashMap();
      configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
      configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
      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 ....
View Full Code Here

    HashMap configuration = new HashMap();
    configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
    configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
   
    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
View Full Code Here

    HashMap configuration = new HashMap();
    configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
    configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
   
    try {
      IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration);
      officeAplication.activate();
      IDocumentService documentService = officeAplication.getDocumentService();
      IDocument document = documentService.constructNewDocument("TestDocument",documentDescriptor);
      ITextDocument textDocument = (ITextDocument)document;
      textDocument.addCloseListener(new SnippetDocumentCloseListener(officeAplication));
     
      /*
 
View Full Code Here

    HashMap configuration = new HashMap();
    configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
    configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
   
    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));
     
      /*
 
View Full Code Here

    hashMap.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.REMOTE_APPLICATION);
    hashMap.put(IOfficeApplication.APPLICATION_HOST_KEY, host);
    hashMap.put(IOfficeApplication.APPLICATION_PORT_KEY, port);
   
    try {
      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

      HashMap configuration = new HashMap();
      configuration.put(IOfficeApplication.APPLICATION_HOME_KEY,
          OPEN_OFFICE_ORG_PATH);
      configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY,
          IOfficeApplication.LOCAL_APPLICATION);
      final IOfficeApplication officeAplication = OfficeApplicationRuntime
          .getApplication(configuration);
      officeAplication.setConfiguration(configuration);
      officeAplication.activate();
      IDocumentService documentService = officeAplication.getDocumentService();
      IDocument document = documentService.constructNewDocument(
          IDocument.WRITER, new DocumentDescriptor());

      ITextDocument textDocument = (ITextDocument) document;

      boolean useStream = true;
      GraphicInfo graphicInfo = null;

      String imagePath = "d:\\my_image.gif";
      int pixelWidth = 265;
      int pixelHeight = 256;

      if(!useStream) {
        //with url
        graphicInfo = new GraphicInfo(imagePath, pixelWidth, true, pixelHeight, true,
            VertOrientation.TOP, HoriOrientation.LEFT,
            TextContentAnchorType.AT_PARAGRAPH);
      }
      else {
        //with stream
        graphicInfo = new GraphicInfo(new FileInputStream(imagePath), pixelWidth,
            true, pixelHeight, true, VertOrientation.TOP, HoriOrientation.LEFT,
            TextContentAnchorType.AT_PARAGRAPH);
      }

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

      ITextCursor textCursor = textDocument.getTextService().getText()
          .getTextCursorService().getTextCursor();

      ITextDocumentImage textDocumentImage = textContentService
          .constructNewImage(graphicInfo);
      textContentService.insertTextContent(textCursor.getEnd(),
          textDocumentImage);

      officeAplication.deactivate();
    }
    catch(OfficeApplicationException exception) {
      exception.printStackTrace();
    }
    catch(Throwable exception) {
View Full Code Here

    hashMap.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
    hashMap.put(IOfficeApplication.APPLICATION_HOME_KEY, officeHome);
  
    try {
      System.out.println("Activating OpenOffice.org connection ...");
      final IOfficeApplication application = OfficeApplicationRuntime.getApplication(hashMap);
      application.activate();           
      final Frame frame = new Frame();
      frame.setVisible(true);
      frame.setSize(400, 400);
      frame.validate();
      Panel panel = new Panel(new BorderLayout());
      frame.add(panel)
      panel.setVisible(true);
      frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          frame.dispose();
          document.close();
          file.delete();
          try {
            System.out.println("Deactivating OpenOffice.org connection ...");
            application.deactivate();
          }
          catch (OfficeApplicationException applicationException) {           
          }
        }       
      });     
     
      System.out.println("Constructing document for test ...");
      IFrame officeFrame = application.getDesktopService().constructNewOfficeFrame(panel);     
      document = application.getDocumentService().constructNewHiddenDocument(IDocument.WRITER);
      System.out.println("Document for test constructed.");
      file = new File("OfficeBeanTest.odt");
      document.getPersistenceService().store(new FileOutputStream(file));
      document.close()
      System.out.println("Loading document for test ...");
      document = application.getDocumentService().loadDocument(officeFrame, new FileInputStream(file), new DocumentDescriptor());
      System.out.println("Document for test loaded.");
      frame.validate();
      officeFrame.getXFrame().getController().suspend(true);
      document.close();

      frame.dispose();
      document.close();
      file.delete();
      try {
        System.out.println("Deactivating OpenOffice.org connection ...");
        application.deactivate();
      }
      catch (OfficeApplicationException applicationException) {           
      }        
    }
    catch(Throwable throwable) {
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.application.IOfficeApplication

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.