Apache POI: Difference between revisions
Jump to navigation
Jump to search
Line 61: | Line 61: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
* [https://stackoverflow.com/questions/24203087/ Replacing a text in Apache POI XWPF not working] | |||
* [https://stackoverflow.com/questions/53664034/ Replace a text in different header for each section] | * [https://stackoverflow.com/questions/53664034/ Replace a text in different header for each section] | ||
* [https://stackoverflow.com/questions/6201736/ Using apache POI convert MS Word to PDF] | * [https://stackoverflow.com/questions/6201736/ Using apache POI convert MS Word to PDF] | ||
* [https://stackoverflow.com/questions/8398259/ Replace table column value in Apache POI] | |||
* [https://stackoverflow.com/questions/19393505/ Replace placeholders in header of docx] | |||
* [https://stackoverflow.com/questions/22615594/ Replacing variables in a MS Word] | * [https://stackoverflow.com/questions/22615594/ Replacing variables in a MS Word] | ||
* [https://stackoverflow.com/questions/3022376/ Convert a Word document to PDF] | * [https://stackoverflow.com/questions/3022376/ Convert a Word document to PDF] |
Revision as of 01:57, 4 January 2022
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.poi.xwpf.converter.pdf</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
|
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>4.1.2</version>
</dependency>
|
| |
LocalDateTime startTime = LocalDateTime.now();
XWPFDocument doc = new XWPFDocument(new ClassPathResource("/META-INF/chorke/template.docx").getInputStream());
String pdfFilePath = String.format("%s/.chorke/academia/var/pdf/report.pdf", System.getProperty("user.home"));
PdfOptions options = PdfOptions.create();
OutputStream out = new FileOutputStream(pdfFilePath);
PdfConverter.getInstance().convert(doc, out, options);
out.close()
double duration = Duration.between(startTime, LocalDateTime.now()).toMillis()/1000.0;
LOG.info("Duration: {} seconds", String.format("%.2f", duration));
|