Skip to content

Commit

Permalink
Bump JODConverter from 4.2.2 to 4.4.2 (#23) (#24)
Browse files Browse the repository at this point in the history
* Bump JODConverter from 4.2.2 to 4.4.2

* Update sample

* add start/stop officemanager
  • Loading branch information
maruTA-bis5 committed Sep 12, 2021
1 parent a20c73b commit 3afdfc6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 26 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ ${LIBREOFFICE_HOME}/program/soffice -headless -accept=socket,port=8100;urp;
```
ReportProcessor reportProcessor = new ReportProcessor();
OfficeManager officeManager =
new ExternalOfficeManagerBuilder().setPortNumber( 8100).build();
ExternalOfficeManager.builder().portNumbers( 8100).build();
officeManager.start();
reportProcessor.addReportBookExporter( new OoPdfExporter(officeManager));
reportProcessor.process( outputBook);
officeManager.stop();
```

6. 更新履歴
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<dependency>
<groupId>org.jodconverter</groupId>
<artifactId>jodconverter-local</artifactId>
<version>4.2.2</version>
<version>4.4.2</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@
package org.bbreak.excella.reports.exporter;

import java.io.File;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.poi.ss.usermodel.Workbook;
import org.bbreak.excella.core.BookData;
import org.bbreak.excella.core.exception.ExportException;
import org.bbreak.excella.reports.model.ConvertConfiguration;
import org.jodconverter.LocalConverter;
import org.jodconverter.document.DefaultDocumentFormatRegistry;
import org.jodconverter.document.DocumentFamily;
import org.jodconverter.document.DocumentFormat;
import org.jodconverter.document.DocumentFormatRegistry;
import org.jodconverter.document.SimpleDocumentFormatRegistry;
import org.jodconverter.office.DefaultOfficeManagerBuilder;
import org.jodconverter.office.OfficeException;
import org.jodconverter.office.OfficeManager;
import org.jodconverter.core.document.DefaultDocumentFormatRegistry;
import org.jodconverter.core.document.DocumentFamily;
import org.jodconverter.core.document.DocumentFormat;
import org.jodconverter.core.document.DocumentFormatRegistry;
import org.jodconverter.core.document.SimpleDocumentFormatRegistry;
import org.jodconverter.core.office.OfficeException;
import org.jodconverter.core.office.OfficeManager;
import org.jodconverter.local.LocalConverter;
import org.jodconverter.local.office.ExternalOfficeManager;

/**
* OpenOfficePDF出力エクスポーター
Expand Down Expand Up @@ -124,7 +125,7 @@ public void output( Workbook book, BookData bookdata, ConvertConfiguration confi
}

if ( !controlOfficeManager) {
officeManager = new DefaultOfficeManagerBuilder().setPortNumbers( port).build();
officeManager = ExternalOfficeManager.builder().portNumbers( port).build();
try {
officeManager.start();
} catch ( OfficeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.poi.ss.usermodel.Workbook;
import org.jodconverter.office.OfficeManager;
import org.bbreak.excella.core.BookData;
import org.bbreak.excella.core.exception.ExportException;
import org.bbreak.excella.reports.model.ConvertConfiguration;
import org.jodconverter.core.office.OfficeManager;

/**
* PDFをStreamに書き出すExporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
import java.util.Calendar;
import java.util.List;

import org.jodconverter.office.ExternalOfficeManagerBuilder;
import org.jodconverter.office.OfficeManager;
import org.bbreak.excella.reports.exporter.OoPdfExporter;
import org.bbreak.excella.reports.model.ReportBook;
import org.bbreak.excella.reports.model.ReportSheet;
import org.bbreak.excella.reports.processor.ReportProcessor;
import org.bbreak.excella.reports.tag.ImageParamParser;
import org.bbreak.excella.reports.tag.RowRepeatParamParser;
import org.bbreak.excella.reports.tag.SingleParamParser;
import org.jodconverter.core.office.OfficeManager;
import org.jodconverter.local.office.ExternalOfficeManager;

/**
* 請求書サンプル出力クラス
Expand Down Expand Up @@ -137,9 +137,14 @@ public static void main( String[] args) throws Exception {
// ReportBookを元にレポート処理を実行します。
//
ReportProcessor reportProcessor = new ReportProcessor();
OfficeManager officeManager = new ExternalOfficeManagerBuilder().setPortNumber( 8100).build();
reportProcessor.addReportBookExporter( new OoPdfExporter(officeManager));
reportProcessor.process( outputBook);
OfficeManager officeManager = ExternalOfficeManager.builder().portNumbers( 8100).build();
try {
officeManager.start();
reportProcessor.addReportBookExporter( new OoPdfExporter(officeManager));
reportProcessor.process( outputBook);
} finally {
officeManager.stop();
}

System.exit( 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import java.util.Date;

import org.apache.poi.ss.usermodel.Workbook;
import org.jodconverter.office.ExternalOfficeManagerBuilder;
import org.jodconverter.office.OfficeManager;
import org.bbreak.excella.core.BookData;
import org.bbreak.excella.core.exception.ExportException;
import org.bbreak.excella.reports.ReportsTestUtil;
import org.bbreak.excella.reports.model.ConvertConfiguration;
import org.bbreak.excella.reports.processor.ReportsWorkbookTest;
import org.jodconverter.core.office.OfficeException;
import org.jodconverter.core.office.OfficeManager;
import org.jodconverter.local.office.ExternalOfficeManager;
import org.junit.Test;

/**
Expand All @@ -52,14 +53,16 @@ public OoPdfExporterTest( String version) {

ConvertConfiguration configuration = null;

private OfficeManager officeManager = new ExternalOfficeManagerBuilder().setPortNumber( 8100).build();
private OfficeManager officeManager = ExternalOfficeManager.builder().portNumbers( 8100).build();

/**
* {@link org.bbreak.excella.reports.exporter.OoPdfExporter#output(org.apache.poi.ss.usermodel.Workbook, org.bbreak.excella.core.BookData, org.bbreak.excella.reports.model.ConvertConfiguration)}
* のためのテスト・メソッド。
* @throws OfficeException
*/
@Test
public void testOutput() {
public void testOutput() throws OfficeException {
officeManager.start();

OoPdfExporter exporter = new OoPdfExporter( officeManager);
String filePath = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
import java.net.URLDecoder;
import java.util.Date;

import org.jodconverter.office.ExternalOfficeManagerBuilder;
import org.jodconverter.office.OfficeManager;
import org.bbreak.excella.reports.ReportsTestUtil;
import org.bbreak.excella.reports.model.ConvertConfiguration;
import org.bbreak.excella.reports.model.ReportBook;
import org.bbreak.excella.reports.model.ReportSheet;
import org.bbreak.excella.reports.processor.ReportProcessor;
import org.jodconverter.core.office.OfficeException;
import org.jodconverter.core.office.OfficeManager;
import org.jodconverter.local.office.ExternalOfficeManager;
import org.junit.Test;

/**
Expand All @@ -50,14 +51,16 @@ public class OoPdfOutputStreamExporterTest {

ConvertConfiguration configuration = null;

private OfficeManager officeManager = new ExternalOfficeManagerBuilder().setPortNumber( 8100).build();
private OfficeManager officeManager = ExternalOfficeManager.builder().portNumbers( 8100).build();

/**
* {@link org.bbreak.excella.reports.exporter.OoPdfOutputStreamExporter#output(org.apache.poi.ss.usermodel.Workbook, org.bbreak.excella.core.BookData, org.bbreak.excella.reports.model.ConvertConfiguration)}
* のためのテスト・メソッド。
* @throws OfficeException
*/
@Test
public void testOutput() {
public void testOutput() throws OfficeException {
officeManager.start();

// XLSテスト� - フォーマット複数指定・サイズ比較テスト
FileOutputStream xlsFileOutputStream = null;
Expand Down

0 comments on commit 3afdfc6

Please sign in to comment.