I'm trying to write bar codes to a word file using a font. The problem is, what I usually use to write to files is the PrintWriter class, but it does not allow fonts.
File file = new File("path\\Test.rtf"); if(file.exists()) file.delete(); try { file.createNewFile(); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Invalid path", "Error", JOptionPane.ERROR_MESSAGE); } FileWriter fw; try { fw = new FileWriter(file); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Invalid path", "Error", JOptionPane.ERROR_MESSAGE); return; } PrintWriter output = new PrintWriter(fw);
I use the output object to write to the file but there is not a PrintWriter.setFont() method