PreviousNext
Help > Programmation avec LAUNCHER Office > Les commandes LNCCMD > Utilisation de LNCCMD en Java : exemple
Utilisation de LNCCMD en Java : exemple

 

package test;

import fr.aura.launcher.wrapper.LNCClientWrapper;
import fr.aura.launcher.wrapper.LNCSrvAckMsg;
import fr.aura.launcher.wrapper.LauncherException;

public class TestCMD
{

       public static void main(String[] args)
       {     

             String pSvrAddr = "127.0.0.1";
             int pSvrPort = 6078;
             LNCSrvAckMsg iRetLNCCMD = null;

             LNCClientWrapper test = new LNCClientWrapper();

             test.LNCOPEN(pSvrAddr,pSvrPort);

             try
             {
                    iRetLNCCMD = test.LNCCMD("WORDOPEN",null,null,null);
             }
             catch (LauncherException e)
             {
                    e.printStackTrace();
             }  
             System.out.println(iRetLNCCMD.getMsg());

             Parm1 = "C:\\temp\\essai2.docx";
             String Parm2 = "visible";


             try
             {
                    iRetLNCCMD = test.LNCCMD("WOPENFILE",null,Parm1,Parm2);
             }
             catch (LauncherException e)
             {
                    e.printStackTrace();
             }  
             System.out.println(iRetLNCCMD.getMsg());

             Parm1 = "File=C:\\temp\\testPdf_9b6_result.pdf;EmbedFonts=True";

 

             try
             {
                    iRetLNCCMD = test.LNCCMD("PDFPRINTER",null,Parm1,null);

             }
             catch (LauncherException e)
             {
                    e.printStackTrace();
             }  
             System.out.println(iRetLNCCMD.getMsg());

             Parm1 = "Printer=\"LAUNCHER_PDF\"";    

      
             try
             {
                    iRetLNCCMD = test.LNCCMD("WPRINT",null,Parm1,null);
             }
             catch (LauncherException e)
             {
                    e.printStackTrace();
             }  
             System.out.println(iRetLNCCMD.getMsg());

             Parm1 = "Save=false";

      
             try
             {
                    iRetLNCCMD = test.LNCCMD("WORDCLOSE",null,Parm1,null);
             }
             catch (LauncherException e)
             {
                    e.printStackTrace();
             }  
             System.out.println(iRetLNCCMD.getMsg());

             test.LNCCLOSE();

       }

 

}