안규 공부방

ACTIVE SERVER PAGE > HTML 을 Excel파일로 변환

등록일 : 2017-07-04 14:04 조회수 : 93,140

asp 파일 내용을 excel 파일로 다운을 받게 하고 싶다면, ContentType 형만 아래처럼 지정만 해 주면 된다...
asp로 인식하지 않고 ms_excel로 인식하게 된다.

바로 다운을 받게 되는데,, 이때,,,, 확장자만을,,, *.xls로 저장하면 되는 것이다.. 넘 쉽나요???
그리구, 엑셀을 실행시켜 열어보자,,, 배경색까지,, 그대로 저장되어 있음을 알수 있다....
<% 
	Response.buffer = ture
	Response.ContentType = "application/vnd.ms-excel"
        filename="엑셀파일.xls"		
        Response.addHeader "Content-Disposition","attachment;filename="&filename


	%>
	<table border="1" bordercolor="green">
	<tbody>
		<tr>
			<td colspan="3" width="693">
			<p align="center"><code class="hljs"><font size="6"><b>안녕하세요... 엑셀 연습중...</b></font></code></p>
			</td>
		</tr>
		<tr>
			<td bgcolor="yellow" height="33" width="229">
			<p align="center"><code class="hljs">111</code></p>
			</td>
			<td bgcolor="yellow" height="33" width="254">
			<p align="center"><code class="hljs">222</code></p>
			</td>
			<td bgcolor="yellow" height="33" width="198">
			<p align="center"><code class="hljs">333</code></p>
			</td>
		</tr>
		<tr>
			<td bgcolor="yellow" height="37" width="229">
			<p align="center"><code class="hljs">444</code></p>
			</td>
			<td bgcolor="yellow" height="37" width="254">
			<p align="center"><code class="hljs">555</code></p>
			</td>
			<td bgcolor="yellow" height="37" width="198">
			<p align="center"><code class="hljs">666</code></p>
			</td>
		</tr>
	</tbody>
</table>
 
※ 혹시 도움이 되셨다면 댓글에 한마디 남겨주세요!
작성자   비밀번호
자동글 방지     (자동글 방지 기능입니다.)
내용   댓글달기 
이메일 문의 : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.