import msword.*; import java.io.*; import ezjcom.*; public class HelloWord { public static void main( String[] args ) { try { // Launch MS Word and type Hello, World in there Application msword = new Application(); _Application app = msword.get_Application(); app.setVisible( true ); // IMPORTANT: Otherwise you will not see the app app.getDocuments().Add(); // Add a new document object // Type "Hello, World!" in the document app.getSelection().TypeText( "Hello, " ); // We also set the font to "Bold for the "World" app.getSelection().getFont().get_Font().setBold( 1 ); app.getSelection().TypeText( "World" ); app.getSelection().getFont().get_Font().setBold( 0 ); app.getSelection().TypeText( " !" ); } catch (Exception ex) { ex.printStackTrace(); } } }