YNICTE/ClipReport4/ClipReport4/export/exportForHWP.aspx

92 lines
2.8 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="CLIPreport.OOF"%>
<%@ Import Namespace="CLIPreport.SDK"%>
<%
ReportUtil reportUtil = ReportUtil.getInstance();
OOFDocument oof = OOFDocument.newOOF();
OOFFile file = oof.addFile("crf", "CLIP.crf");
//한글저장에 대한 옵션을 설정합니다.
HWPExportOption option = ExportOptions.hwp();
// 페이지 범위. 2-9, 1-, -5 와 같이 범위를 설정할 수 있습니다.
//option.setPageRange("1-");
/* fixSize(Boolean) 크기 고정*/
option.setFixSize(true);
/* allowOverlay(Boolean) 겹침 허용*/
option.setAllowOverlay(true);
/* setPageBottomMarginToZero(Boolean) 페이지 바닥 여백을 0으로 설정*/
option.setSetPageBottomMarginToZero(true);
/* outputLikeWord(Boolean) 글자처럼 출력*/
option.setOutputLikeWord(false);
/* tableSplitMethod(Integer)
//http://snoworca.iptime.org:52090/setup/setupusermanagementchoice-start.action
>기존 버전(WAS) :
0 = 나눔
1 = 셀 단위로 나눔
2 = 나누지 않음
>현재 버전(데몬) :
HWPExportOption.Split = 나눔
HWPExportOption.SplitByCell = 셀 단위로 나눔
HWPExportOption.NotSplit = 나누지 않음
*/
option.setTableSplitMethod(HWPExportOption.SplitByCell);
/* defaultCharGap(Integer) 기본 자간*/
option.setDefaultCharGap(-8);
/* charRatio(Integer) 자평*/
option.setCharRatio(100);
/* putCheckboxIntoCell (Boolean) 셀 안에 체크박스 넣기 */
option.setPutCheckboxIntoCell(false);
//이웃한 테이블과 병합할 것인지 여부
option.setMergeTable(false);
//줄간격 비율(%)
option.setLineSpaceRate(100);
// 확장자를 제외한 파일이름, 파일이름으로 사용될 수 없는 문자열은 '_' 으로 치환됩니다.
String fileName = "----한글-파일-이름-테스트-문서(특수문자:#$%^&)";
option.setName(fileName);
/*
try { */
// 웹 브라우저를 통하여 파일을 다운로드 받을 때 아래의 코드를 사용.
reportUtil.sendExport(Request,Response, oof, option);
// 파일 저장시 아래 코드 사용.
//File directory = new File("저장될 파일이 위치할 디렉토리");
//reportUtil.saveExport(directory, oof, option);
/*
} catch(OutOfLicenseException e) {
e.printStackTrace();
// 라이센스 없음.
} catch(CRFFileNotFoundException e) {
e.printStackTrace();
// CRF (혹은 reb) 파일 찾을 수 없음.
} catch(ServerConnectionFailExecption e) {
e.printStackTrace();
// 서버와 연결할 수 없음.
} catch(APIRemoteCallErrorException e) {
e.printStackTrace();
// 어떠한 이유로 API 를 호출할 수 없음. (주로 네트워크 오류)
} catch(APIFailException e) {
e.printStackTrace();
// API 호출 실패.
}
*/
return;
%>