diff --git a/src/main/java/cokr/xit/base/docs/hwp/HWPWriter.java b/src/main/java/cokr/xit/base/docs/hwp/HWPWriter.java index 0cb4982..432fcea 100644 --- a/src/main/java/cokr/xit/base/docs/hwp/HWPWriter.java +++ b/src/main/java/cokr/xit/base/docs/hwp/HWPWriter.java @@ -10,6 +10,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import cokr.xit.foundation.Assert; +import cokr.xit.foundation.Downloadable; import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.object.bodytext.control.Control; import kr.dogfoot.hwplib.object.bodytext.control.ControlField; @@ -176,4 +177,14 @@ public class HWPWriter extends HWP { throw Assert.runtimeException(e); } } + + /**현재 HWPWriter를 Downloadable로 변환한다. + * 결과로 받은 Downloadable은 파일이름을 지정해야 한다. + * @return Downloadable + */ + public Downloadable getDownloadable() { + return new Downloadable() + .setContentType(MIME_TYPE) + .setWriter(this::write); + } } \ No newline at end of file diff --git a/src/main/java/cokr/xit/base/docs/xls/XLSWriter.java b/src/main/java/cokr/xit/base/docs/xls/XLSWriter.java index ad009ea..c3aa71c 100644 --- a/src/main/java/cokr/xit/base/docs/xls/XLSWriter.java +++ b/src/main/java/cokr/xit/base/docs/xls/XLSWriter.java @@ -15,6 +15,8 @@ import java.util.stream.IntStream; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.util.CellRangeAddress; +import cokr.xit.foundation.Downloadable; + /**엑셀 파일 작성 클래스 * @author mjkhan */ @@ -346,4 +348,14 @@ public class XLSWriter extends XLS { super.clear(all); trackWidths = null; } + + /**현재 XLSWriter를 Downloadable로 변환한다. + * 결과로 받은 Downloadable은 파일이름을 지정해야 한다. + * @return Downloadable + */ + public Downloadable getDownloadable() { + return new Downloadable() + .setContentType(MIME_TYPE) + .setWriter(this::write); + } } \ No newline at end of file