title: Writing String to file in bold and underlined style
body: <p>I have class <code>WriteFile</code> which has method <code>WriteToFile</code> which writes <code>String</code> to word document.</p>
  
  <pre><code>  WriteFile data=new WriteFile("C:/test3.doc",true);  
    data.writeToFile(user.saxeli+" "+user.gvari+" "+user.asaki+" "+user.swori);
  </code></pre>
  
  <p>How to write <code>String</code> to "test3.doc" in bold and underlined style?</p>
  
  <p>Here is the WriteFile class:</p>
  
  <pre><code>import java.io.FileWriter;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  public class WriteFile {
  
   private String path;
   private boolean append=true;
   public WriteFile(String path,boolean append){
    this.path=path; this.append=append;
  }
   public void writeToFile(String text) throws IOException{
    FileWriter write=new FileWriter(path,append);
    PrintWriter print_line= new PrintWriter(write);
    print_line.printf("%s"+"%n", text);
    print_line.close();
  }
  }
  </code></pre>