방금 Apache-POI를 사용하여 몇 가지 기본 .doc 및 .docx 조작을 수행하는 방법을 배웠습니다. 이제는 응용 프로그램 내에서 해당 문서를 인쇄하려고합니다. 어떤 생각을 내가 어떻게 할 수 있니? 이 내가 문서를 만드는 방법은 다음과 같습니다java에서 .doc 및 .docx를 인쇄하는 방법
public void newWordDoc(String filename) throws FileNotFoundException, IOException {
XWPFDocument document = new XWPFDocument();
XWPFParagraph tmpParagraph = document.createParagraph();
XWPFRun tmpRun = tmpParagraph.createRun();
tmpRun.setText("Writing to a .doc");
tmpRun.setFontSize(18);
document.write(new FileOutputStream(new File(filename + ".doc")));
}
public void newWordDocX(String filename) throws FileNotFoundException, IOException {
XWPFDocument document = new XWPFDocument();
XWPFParagraph tmpParagraph = document.createParagraph();
XWPFRun tmpRun = tmpParagraph.createRun();
tmpRun.setText("Writing to a .docx");
tmpRun.setFontSize(18);
document.write(new FileOutputStream(new File(filename + ".docx")));
}
지금 내가 바로 다시 읽고 그들을 인쇄 몇 가지 방법을 만들어야합니다 가정? 프린터에서 인쇄하는 가장 쉽고 빠른 방법은 무엇입니까? Java 인쇄 API를 사용해야합니까, 아니면 더 쉽게 사용할 수있는 프리웨어 API가 있습니까? 또한 나는 다른 곳에서 java cant가 워드 문서를 인쇄하는 것과 같은 일을하는 포스트에 탔다는 것을 언급하고 싶습니다. 그리고 우리는 먼저 PDF로 변환해야합니다. 그게 사실이야? 나는 :(하지 희망
docx4j는 docx를 PDF (또는 그 문제에 대해서는 HTML)로 변환 할 수 있으므로 PDF 인쇄 솔루션이있는 경우 도움이 될 수 있습니다. – JasonPlutext
@plutext : +1 그런 일이 있는지 몰랐습니다! – Daniel