Народ подскажите в IDE создание документа Word работает как надо, но когда перевожу в "ехе", создается файл с именем в размере 0 КБ и пуст (в IDE весит 5 КБ).
public void PrintJob (ActionEvent actionEvent) throws IOException {
//Blank Document
//Write the Document in file system
OutputStream fileOut = new FileOutputStream( "C:\\Project\\"+ FIO +"_"+ DATE +".docx" );
try ( XWPFDocument document = new XWPFDocument()) {
XWPFParagraph paragraphNamedoc = document.createParagraph();
XWPFRun paragraph1 = paragraphNamedoc.createRun();
paragraphNamedoc.setAlignment( ParagraphAlignment.CENTER );
paragraph1.setBold( true );
paragraph1.setItalic( true );
paragraph1.setText( "ЭКГ - АФФС" );
paragraph1.setFontSize( 18 );
paragraph1.setTextPosition( 1 );
document.write( fileOut );
out.println( "File created" );
fileOut.close();
document.close();
//out.println( "File created");
JOptionPane.showMessageDialog( null, "Файл создан в папке Project", "", JOptionPane.WARNING_MESSAGE );
} catch (Exception e) {
out.println( e.getMessage() );
}
}
Помогите советом. В "ехе" конвертирую ПО Launch4j, чтоб можно было запускаться без особых заморочек. Спасибо!