Parcourir la source

엑셀스타일 저장처리

isna il y a 2 ans
Parent
commit
8e73373430
4 fichiers modifiés avec 26543 ajouts et 15 suppressions
  1. 13 14
      src/main/webapp/js/app/config.js
  2. 1506 0
      src/main/webapp/js/cpexcel.js
  3. 25019 0
      src/main/webapp/js/xlsx.js
  4. 5 1
      src/main/webapp/main.html

+ 13 - 14
src/main/webapp/js/app/config.js

@@ -29,10 +29,11 @@ requirejs.config({
29 29
 		'smarteditor2': 'se2/js/service/HuskyEZCreator',
30 30
 		'message.locale': 'js/app/locales/locale-' + ITP_LANGUAGE + '.js?version='+js_version,
31 31
 		'kakao.postcode': 'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2',		
32
+		// 'kakao.maps': 'https://dapi.kakao.com/v2/maps/sdk.js?appkey=16051f864cde43fd1157f61c0fef7c6e&libraries=services,clusterer&autoload=false',
32 33
 		'kakao.maps': 'https://dapi.kakao.com/v2/maps/sdk.js?appkey=a2ce7c66185a5413095b6485ac9ad3cd&libraries=services,clusterer&autoload=false',
33 34
 		'kakao.map.util': 'js/app/kakao.map', 				// Crypto 암호화 js
34 35
 		'file.saver': 'js/FileSaver.min',					// 엑셀 다운로드 (JSON 데이터를 파일로 전환)
35
-		'xlsx': 'js/xlsx.full.min',							// 엑셀 다운로드 (JSON 데이터를 파일로 전환)
36
+		// 'xlsx': 'js/xlsx.full.min',							// 엑셀 다운로드 (JSON 데이터를 파일로 전환)
36 37
 		'html2canvas': 'js/html2canvas.min',				// PDF 다운로드 (html 객체를 canvas로 변환)
37 38
 		'jspdf': 'js/jspdf.min',							// PDF 다운로드 (html, 이미지, canvas 객체를 pdf로 변환)
38 39
 		// 'jspdf.autotable': 'js/jspdf.plugin.autotable.min',	// PDF 다운로드 (html, 이미지, canvas 객체를 pdf로 변환)
@@ -68,10 +69,7 @@ requirejs.config({
68 69
 				'jquery.jqGrid.treegrid',
69 70
 				'jquery.jqGrid.fmatter'
70 71
 			]
71
-		},
72
-		'xlsx': {
73
-			deps: ['file.saver']
74
-		},
72
+		}, 
75 73
 		'kakao.map.util': {
76 74
 			deps: [
77 75
 				'kakao.postcode',
@@ -3170,13 +3168,13 @@ var itp_fn_remote_to_excel = function(options) {
3170 3168
 		const fileName=options.fileName;
3171 3169
 		const data = [], header=[], headerWidths=[], cols=[], mapAlign={};
3172 3170
 		// alignment: { vertical: 'center', horizontal: 'center', wrapText: true }
3173
-		const BORDER_ALL = { border: { top: { style: 'thick' }, right: { style: 'thick' }, bottom: { style: 'thick' }, left: { style: 'thick' } } };
3171
+		const BORDER_ALL = { border: { top: { style: 'thin' }, right: { style: 'thin' }, bottom: { style: 'thin' }, left: { style: 'thin' } } };
3174 3172
 		for(var c of options.gridColumns) {
3175 3173
 			if(c.hidden || !c.label ) continue;
3176
-			const fill = { fgColor: { rgb: '5ebd3e' } };
3177
-			const font = { bold: true, color: { rgb: 'FFFFFF' } };
3174
+			const fill = { fgColor: { rgb: '808080' } };
3175
+			const font = { bold: true, sz: 10, name:'맑은 고딕', color: { rgb: 'FFFFFF' } };
3178 3176
 			const alignment = { vertical: 'center', horizontal: 'center', wrapText: true }
3179
-			var width=parseInt(Number(c.width)/7);
3177
+			var width=parseInt(Number(c.width)/5);
3180 3178
 			if(!width ) width=10;
3181 3179
 			header.push({v:c.label,t:'s',s:{...BORDER_ALL,fill,font,alignment}});
3182 3180
 			headerWidths.push({width});
@@ -3189,9 +3187,9 @@ var itp_fn_remote_to_excel = function(options) {
3189 3187
 		for(var c of result.gridRows) {
3190 3188
 			const row=[];
3191 3189
 			for(var name of cols ) {
3192
-				const sty={...BORDER_ALL}; 
3190
+				const sty={...BORDER_ALL, font:{ sz: 10, name:'맑은 고딕'}}; 
3193 3191
 				const align=mapAlign[name];
3194
-				if(align ) sty.alignment = { vertical: 'center', horizontal:align, wrapText: true };
3192
+				if(align ) sty.alignment = { vertical: 'center', horizontal:align  };
3195 3193
 				row.push({v:c[name], t:'s',s:sty});
3196 3194
 			}
3197 3195
 			data.push(row);
@@ -3201,10 +3199,11 @@ var itp_fn_remote_to_excel = function(options) {
3201 3199
 		ws['!cols'] = headerWidths;
3202 3200
 
3203 3201
 		XLSX.utils.book_append_sheet(wb, ws, options.sheetName); 
3204
-		var wbout = XLSX.write(wb, {bookType:'xlsx', bookSST:false, type: 'binary', showGridLines:true, cellStyles:true });
3202
+		// var wbout = XLSX.write(wb, {bookType:'xlsx', bookSST:false, type: 'binary', showGridLines:true, cellStyles:true });
3205 3203
 		// 엑셀 파일 내보내기 
3206
-		console.log("itp_fn_remote_to_excel callback => ",ws );
3207
-		saveAs(new Blob([itp_fn_s2ab(wbout)],{type:"application/octet-stream"}), fileName); 
3204
+		// console.log("itp_fn_remote_to_excel callback => ",ws );
3205
+		XLSX.writeFile(wb, fileName);
3206
+		// saveAs(new Blob([itp_fn_s2ab(wbout)],{type:"application/octet-stream"}), fileName); 
3208 3207
 	};
3209 3208
 	fn_ajax_call(options.url, JSON.stringify(options.param), callbackFn, 'POST');
3210 3209
 };

Fichier diff supprimé car celui-ci est trop grand
+ 1506 - 0
src/main/webapp/js/cpexcel.js


Fichier diff supprimé car celui-ci est trop grand
+ 25019 - 0
src/main/webapp/js/xlsx.js


+ 5 - 1
src/main/webapp/main.html

@@ -40,6 +40,7 @@
40 40
 
41 41
 	<script src="./js/app/properties.js"></script>
42 42
 	<script src="./js/require.min.js" data-main="./js/app/config.js"></script>
43
+
43 44
 	<style>
44 45
 		#ITP_NOTE_PANEL {
45 46
 			margin-top: 16px;
@@ -803,6 +804,9 @@
803 804
 		<aside id="ITP_ASIDE"></aside>	
804 805
 		
805 806
 		
806
-	</div>
807
+	</div> 
808
+	<script src="./js/cpexcel.js"></script>
809
+	<script src="./js/xlsx.js"></script>
810
+
807 811
 </body>
808 812
 </html>