Example usage for org.apache.poi.hwpf.usermodel CharacterRun setBold

List of usage examples for org.apache.poi.hwpf.usermodel CharacterRun setBold

Introduction

In this page you can find the example usage for org.apache.poi.hwpf.usermodel CharacterRun setBold.

Prototype

public void setBold(boolean bold) 

Source Link

Usage

From source file:File.DOC.WriteDoc.java

/**
 * @param args the command line arguments
 *//*from w w  w. j ava 2  s.c om*/
public void Write(String path, String namafile, String content) {
    File file = new File("D:\\xyz.doc");
    try {
        POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
        HWPFDocument doc = new HWPFDocument(fs);
        Range range = doc.getRange();
        CharacterRun run = range.insertBefore(content.replace("\n", "\013"));
        run.setBold(true);
        OutputStream outa = new FileOutputStream(new File(path + namafile + ".doc"));
        doc.write(outa);
        out.close();
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}