ASP 로 Excel 보여주기

ASP MS SQL에 저장된 DB들을 Excel로 보여줘야 할 일이 있을때..

당연한 얘기지만 Client에 Excel이 설치되어 있어야함.

만일 보이지 않을 경우 IIS 설정에서 ‘쓰기’ 권한이 있는지 체크.
브라우저 cache가 남아 있는 경우가 있으므로 브라우저를 새로 열거나 Header에 no-cache설정을 해줄 것.



< %response.ContentType="application/vnd.ms-excel"%>
<html>
<body>
< %response.Write("Excel 이 보일 경우 이 메세지는 보이지 않음")%>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
</table>
</body>
</html>

ASP.NET의 경우에는 Excel Module을 불러와서 XLS파일을 생성하는것이 가능하다.

Tags:

Leave a Comment