3
* The MIME_Viewer_msexcel class renders out Microsoft Excel
4
* documents in HTML format by using the xlHtml package.
6
* $Horde: framework/MIME/MIME/Viewer/msexcel.php,v 1.20.10.2 2005/01/12 15:02:35 jan Exp $
8
* Copyright 1999-2005 Anil Madhavapeddy <anil@recoil.org>
10
* See the enclosed file COPYING for license information (LGPL). If you
11
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
13
* @author Anil Madhavapeddy <anil@recoil.org>
14
* @version $Revision: 1.20.10.2 $
16
* @package Horde_MIME_Viewer
18
class MIME_Viewer_msexcel extends MIME_Viewer {
21
* Render out the currently data using xlhtml.
25
* @param optional array $params Any params this Viewer may need.
27
* @return string The rendered data.
29
function render($params = array())
33
/* Check to make sure the program actually exists. */
34
if (!file_exists($mime_drivers['horde']['msexcel']['location'])) {
35
return '<pre>' . sprintf(_("The program used to view this data type (%s) was not found on the system."), $mime_drivers['horde']['msexcel']['location']) . '</pre>';
39
$tmp_xls = Horde::getTempFile('horde_msexcel');
41
$fh = fopen($tmp_xls, 'w');
42
fwrite($fh, $this->mime_part->getContents());
45
$fh = popen($mime_drivers['horde']['msexcel']['location'] . " -nh $tmp_xls 2>&1", 'r');
46
while (($rc = fgets($fh, 8192))) {
55
* Return the MIME content type of the rendered content.
59
* @return string The content type of the output.
63
return 'text/html; charset=' . NLS::getCharset();