DiMoN_TD
Новичок
Spreadsheet_Excel_Writer проблема с созданием файлов
Здравствуйте!
В общем установил я себе это библиотеку: Spreadsheet_Excel_Writer-0.9.1 Все как полагается. При выполнении данного скрипта:
Браузер предлагает мне сохранить файл test.xls, я его сохраняю, открываю Microsoft Office'ом и при открытии мне пишет:
"The file you are trying to open, 'test.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open file now?"
Я конечно же отвечаю да, в итоге у меня открывается сам файл. Книга названа test, а вот содержимое книги примерно следующее:
"
\РПаЎ±б;юя
юяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяя
р?$@&@Y@@Y@Ђ[@А[@@Џ@
ђЏ@>
¶
Root Entryяяяяяяяя
яяяяяяяяяяяя
<head>
<title>
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="/admin1.css" rel="stylesheet" type="text/css">
<script language="JavaScript"><!--
function no(v){document.getElementById(v).style.display = 'none';}
function yes(v){document.getElementById(v).style.display = '';}
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);
}
//--></script>
<script language="Javascript" src="/editor/scripts/innovaeditor.js"></script>
<script language="Javascript" src="/js.js"></script>
</head>
<body bgcolor="#ffffff" text="#000000" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td><span class="title-top">Admin Interface</span></td></tr>
<tr><td><a href="/"><span class="title-site">OSMP-Moldova Home Page</span></a></td></tr>
<tr><td> <br> </td></tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0" background="/images/admin/stab_bg.gif">
<tr height="24"><td width="40"><img src="/images/admin/spacer.gif" width="40" height="24" border="0"></td>
<td><table cellspacing="0" cellpadding="0" border="0">
<tr height="24">
<td> </td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td> </td></tr>
</table>
<table width="100%" height="375" cellpadding="0" cellspacing="0" border="0" bgcolor="#F6F6F6">
<tr>
<td width="5" height="5"><img src="/images/admin/corner_tl.gif" width="5" height="5" border="0"></td>
<td><img src="/images/admin/bar_t.gif" width="100%" border="0" height="5"></td>
<td width="5" height="5"><img src="/images/admin/corner_tr.gif" width="5" height="5" border="0"></td>
</tr>
<tr>
<td width="5" height="100%"><img src="/images/admin/bar_l.gif" width="5" height="100%"border="0"></td>
<td valign="top">
<table width="100%" height="100%" cellpadding="2" cellspacing="3" border="0"><tr><td valign="top">
<p></p>
</td></tr></table>
</td>
<td width="5" height="100%"><img src="/images/admin/bar_r.gif" width="5" height="100%" border="0"></td>
</tr>
<tr>
<td width="5" height="5"><img src="/images/admin/corner_bl.gif" width="5" height="5" border="0"></td>
<td><img src="/images/admin/bar_b.gif" width="100%" height="5" border="0"></td>
<td width="5" height="5"><img src="/images/admin/corner_br.gif" width="5" height="5" border="0"></td>
</tr>
</table>
</body>
</html>
"
Почему у меня тут присутствует html код? 0_о и что за иероглифы вначале?
Подскажите возможный путь решения этой проблемы!
Заранее спасибо!
Здравствуйте!
В общем установил я себе это библиотеку: Spreadsheet_Excel_Writer-0.9.1 Все как полагается. При выполнении данного скрипта:
PHP:
<?php
require_once "/usr/local/share/pear/Spreadsheet/Excel/Writer.php";
$xls =& new Spreadsheet_Excel_Writer();
$xls->send("test.xls");
$sheet =& $xls->addWorksheet('Binary Count');
for ( $i=0;$i<11;$i++ ) {
$sheet->write($i,0,decbin($i));
}
$xls->close();
?>
"The file you are trying to open, 'test.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open file now?"
Я конечно же отвечаю да, в итоге у меня открывается сам файл. Книга названа test, а вот содержимое книги примерно следующее:
"
\РПаЎ±б;юя
юяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяя
р?$@&@Y@@Y@Ђ[@А[@@Џ@
ђЏ@>
¶
Root Entryяяяяяяяя
яяяяяяяяяяяя
<head>
<title>
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="/admin1.css" rel="stylesheet" type="text/css">
<script language="JavaScript"><!--
function no(v){document.getElementById(v).style.display = 'none';}
function yes(v){document.getElementById(v).style.display = '';}
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);
}
//--></script>
<script language="Javascript" src="/editor/scripts/innovaeditor.js"></script>
<script language="Javascript" src="/js.js"></script>
</head>
<body bgcolor="#ffffff" text="#000000" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td><span class="title-top">Admin Interface</span></td></tr>
<tr><td><a href="/"><span class="title-site">OSMP-Moldova Home Page</span></a></td></tr>
<tr><td> <br> </td></tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0" background="/images/admin/stab_bg.gif">
<tr height="24"><td width="40"><img src="/images/admin/spacer.gif" width="40" height="24" border="0"></td>
<td><table cellspacing="0" cellpadding="0" border="0">
<tr height="24">
<td> </td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td> </td></tr>
</table>
<table width="100%" height="375" cellpadding="0" cellspacing="0" border="0" bgcolor="#F6F6F6">
<tr>
<td width="5" height="5"><img src="/images/admin/corner_tl.gif" width="5" height="5" border="0"></td>
<td><img src="/images/admin/bar_t.gif" width="100%" border="0" height="5"></td>
<td width="5" height="5"><img src="/images/admin/corner_tr.gif" width="5" height="5" border="0"></td>
</tr>
<tr>
<td width="5" height="100%"><img src="/images/admin/bar_l.gif" width="5" height="100%"border="0"></td>
<td valign="top">
<table width="100%" height="100%" cellpadding="2" cellspacing="3" border="0"><tr><td valign="top">
<p></p>
</td></tr></table>
</td>
<td width="5" height="100%"><img src="/images/admin/bar_r.gif" width="5" height="100%" border="0"></td>
</tr>
<tr>
<td width="5" height="5"><img src="/images/admin/corner_bl.gif" width="5" height="5" border="0"></td>
<td><img src="/images/admin/bar_b.gif" width="100%" height="5" border="0"></td>
<td width="5" height="5"><img src="/images/admin/corner_br.gif" width="5" height="5" border="0"></td>
</tr>
</table>
</body>
</html>
"
Почему у меня тут присутствует html код? 0_о и что за иероглифы вначале?
Подскажите возможный путь решения этой проблемы!
Заранее спасибо!