Moyosoft Products | Services | Download | Contact us    
Java Excel Connector
Products  >  Java Excel Connector  >  Example source code    
package com.moyosoft.samples.excel;

import com.moyosoft.connector.com.*;
import com.moyosoft.connector.exception.*;
import com.moyosoft.connector.ms.excel.*;

public class HelloExcel
{
    public static void main(String[] args)
    {
        try
        {
            // Create the Excel application object
            Excel excel = new Excel();
            
            // Print the Excel application name and version
            System.out.print("Hello " + excel.getName() ". ");
            System.out.println("Your version is: " + excel.getVersion());

            // Dispose the library
            excel.dispose();
        }
        catch (ComponentObjectModelException ex)
        {
            System.out.println("COM error has occured: ");
            ex.printStackTrace();
        }
        catch (LibraryNotFoundException ex)
        {
            // If this error occurs, verify the file 'moyocore.dll' is present
            // in java.library.path
            System.out.println("The Java Excel Library hasn't been found.");
            ex.printStackTrace();
        }
    }
}