익스플로우의 보안에 허용만 가능하면 자바스크립트 상에서도 읽기/쓰기가 가능하다.
우선 text파일 읽고 쓰는 예제이다.(C:\\book1.txt를 읽고 씀)
=====================================================================================================================
<html>
<head>
<title>file save/load</title>
<script type="text/javascript">
var fso=new ActiveXObject("Scripting.FileSystemObject");
var filename="C:\\book1.txt";
function savefile() {
if (!fso.FileExists(filename)) {
fso.CreateTextFile(filename,true);
}
var f=fso.OpenTextFile(filename,2,true);
f.Write(myarea.innerHTML);
f.Close();
}
function loadfile() {
if (!fso.FileExists(filename)) {
fso.CreateTextFile(filename,true);
}
var f=fso.OpenTextFile(filename,1);
r=f.ReadAll();
f.Close();
myarea.innerHTML=r;
}
//function window.onload() {
// loadfile(filename);
//}
</script>
</head>
<body>
<table>
<tr>
<td>
<div id=myarea contenteditable=true style="width:320;height:240;border:solid 2 inset;overflow:scroll;background-color:silver;"></div>
<br><input type=button value=load onclick=loadfile()><input type=button value=save onclick=savefile()>
</td>
</tr>
</table>
</form>
</body>
</html>
======================================Excel 파일 열고 쓰기 =================================================
- 쓰기 -
<script type="text/javascript">
// Declare the variables
var Excel, Book;
// Create the Excel application object.
Excel = new ActiveXObject("Excel.Application");
// Make Excel visible.
Excel.Visible = true;
// Create a new work book.
Book = Excel.Workbooks.Add()
// Place some text in the first cell of the sheet.
Book.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
// Save the sheet.
Book.SaveAs("C:\\book1.xls");
// Close Excel with the Quit method on the Application object.
Excel.Application.Quit();
</script>
- 열기 -
function StartExcel() {
var oExcel;
var oWBook;
oExcel = new ActiveXObject("Excel.Application");
oExcel.Visible = true;
oExcel.workbooks.open("C:/test.xls");
oExcel.Quit();
oExcel = null;
}
간단한 파일 읽기의 경우 상당히 유용할 수 있겠다..
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7230 | 11년 전 | 3596 | ||
| 7229 | 11년 전 | 3714 | ||
| 7228 | 11년 전 | 3777 | ||
| 7227 | 11년 전 | 3901 | ||
| 7226 | 11년 전 | 2358 | ||
| 7225 | 11년 전 | 17433 | ||
| 7224 |
AngryDev
|
11년 전 | 1339 | |
| 7223 |
돌아온깡통
|
11년 전 | 1084 | |
| 7222 |
돌아온깡통
|
11년 전 | 1022 | |
| 7221 |
돌아온깡통
|
11년 전 | 863 | |
| 7220 |
돌아온깡통
|
11년 전 | 984 | |
| 7219 |
돌아온깡통
|
11년 전 | 806 | |
| 7218 |
돌아온깡통
|
11년 전 | 652 | |
| 7217 |
돌아온깡통
|
11년 전 | 1041 | |
| 7216 |
돌아온깡통
|
11년 전 | 777 | |
| 7215 |
돌아온깡통
|
11년 전 | 695 | |
| 7214 |
돌아온깡통
|
11년 전 | 1036 | |
| 7213 |
돌아온깡통
|
11년 전 | 905 | |
| 7212 |
돌아온깡통
|
11년 전 | 695 | |
| 7211 |
돌아온깡통
|
11년 전 | 850 | |
| 7210 |
돌아온깡통
|
11년 전 | 873 | |
| 7209 |
돌아온깡통
|
11년 전 | 880 | |
| 7208 |
돌아온깡통
|
11년 전 | 978 | |
| 7207 |
돌아온깡통
|
11년 전 | 619 | |
| 7206 |
돌아온깡통
|
11년 전 | 664 | |
| 7205 |
돌아온깡통
|
11년 전 | 852 | |
| 7204 |
돌아온깡통
|
11년 전 | 706 | |
| 7203 |
돌아온깡통
|
11년 전 | 735 | |
| 7202 |
돌아온깡통
|
11년 전 | 697 | |
| 7201 |
돌아온깡통
|
11년 전 | 632 | |
| 7200 |
돌아온깡통
|
11년 전 | 692 | |
| 7199 |
돌아온깡통
|
11년 전 | 1306 | |
| 7198 |
돌아온깡통
|
11년 전 | 639 | |
| 7197 |
돌아온깡통
|
11년 전 | 951 | |
| 7196 |
돌아온깡통
|
11년 전 | 841 | |
| 7195 |
돌아온깡통
|
11년 전 | 585 | |
| 7194 |
돌아온깡통
|
11년 전 | 614 | |
| 7193 |
돌아온깡통
|
11년 전 | 689 | |
| 7192 |
돌아온깡통
|
11년 전 | 705 | |
| 7191 |
joe031
|
11년 전 | 1242 | |
| 7190 | 11년 전 | 4123 | ||
| 7189 | 11년 전 | 1196 | ||
| 7188 |
잘살아보자
|
11년 전 | 924 | |
| 7187 | 11년 전 | 1402 | ||
| 7186 |
kiplayer
|
11년 전 | 7521 | |
| 7185 | 11년 전 | 1110 | ||
| 7184 |
잘살아보자
|
11년 전 | 2321 | |
| 7183 |
잘살아보자
|
11년 전 | 1137 | |
| 7182 |
잘살아보자
|
11년 전 | 1189 | |
| 7181 | 11년 전 | 1469 | ||
| 7180 |
하얀비요일
|
11년 전 | 972 | |
| 7179 |
잘살아보자
|
11년 전 | 973 | |
| 7178 | 11년 전 | 975 | ||
| 7177 | 11년 전 | 987 | ||
| 7176 | 11년 전 | 1648 | ||
| 7175 |
|
11년 전 | 1031 | |
| 7174 |
kiplayer
|
11년 전 | 1165 | |
| 7173 | 11년 전 | 953 | ||
| 7172 |
잘살아보자
|
11년 전 | 4630 | |
| 7171 |
잘살아보자
|
11년 전 | 683 | |
| 7170 | 11년 전 | 1060 | ||
| 7169 |
초심의설렘
|
11년 전 | 1459 | |
| 7168 | 11년 전 | 993 | ||
| 7167 |
잘살아보자
|
11년 전 | 5273 | |
| 7166 |
잘살아보자
|
11년 전 | 3401 | |
| 7165 | 11년 전 | 4945 | ||
| 7164 | 11년 전 | 819 | ||
| 7163 | 11년 전 | 1175 | ||
| 7162 |
울라라라우
|
11년 전 | 1358 | |
| 7161 | 11년 전 | 1240 | ||
| 7160 |
skyler
|
11년 전 | 1175 | |
| 7159 |
|
11년 전 | 665 | |
| 7158 |
|
11년 전 | 3328 | |
| 7157 |
잘살아보자
|
11년 전 | 2872 | |
| 7156 |
잘살아보자
|
11년 전 | 2213 | |
| 7155 |
잘살아보자
|
11년 전 | 1442 | |
| 7154 |
잘살아보자
|
11년 전 | 1443 | |
| 7153 | 11년 전 | 2867 | ||
| 7152 |
울라라라우
|
11년 전 | 815 | |
| 7151 | 11년 전 | 1038 | ||
| 7150 |
잘살아보자
|
11년 전 | 2376 | |
| 7149 |
잘살아보자
|
11년 전 | 3279 | |
| 7148 |
잘살아보자
|
11년 전 | 1177 | |
| 7147 |
잘살아보자
|
11년 전 | 749 | |
| 7146 |
잘살아보자
|
11년 전 | 1380 | |
| 7145 |
잘살아보자
|
11년 전 | 686 | |
| 7144 |
잘살아보자
|
11년 전 | 1272 | |
| 7143 |
잘살아보자
|
11년 전 | 736 | |
| 7142 |
잘살아보자
|
11년 전 | 1436 | |
| 7141 |
잘살아보자
|
11년 전 | 1187 | |
| 7140 |
잘살아보자
|
11년 전 | 1987 | |
| 7139 |
잘살아보자
|
11년 전 | 3652 | |
| 7138 |
잘살아보자
|
11년 전 | 3147 | |
| 7137 |
잘살아보자
|
11년 전 | 3619 | |
| 7136 |
잘살아보자
|
11년 전 | 1374 | |
| 7135 |
gooroo
|
11년 전 | 1602 | |
| 7134 |
열라뽕똬이
|
11년 전 | 2303 | |
| 7133 |
|
11년 전 | 1010 | |
| 7132 | 11년 전 | 1423 | ||
| 7131 | 11년 전 | 3564 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기