Ejemplo n.º 1
0
 public function __construct($options = false)
 {
     $this->_driver = 'CSV';
     $this->_badString = array(';', chr(10), chr(13));
     $this->_espapedString = array(' ', ' ', ' ');
     $this->_memoryManager = Zend_Memory::factory('none');
     $this->_memObject = $this->_memoryManager->create();
     try {
         $this->_fileName = 'Report_Excel_' . date('dmyhis') . '.csv';
         $file = new ZendT_File($this->_fileName);
         $this->_fileName = $file->getFilename();
         if (!$this->_fileName) {
             throw new ZendT_Exception('Impossivel criar aquivo', '2');
         }
     } catch (Exception $e) {
         throw new ZendT_Exception($e->getMessage(), $e->getCode());
     }
 }
Ejemplo n.º 2
0
    public function __construct($options = false)
    {
        $default = array('empresa' => 'TA', 'orientation' => 'P', 'unit' => 'mm', 'size' => 'A4', 'outputName' => 'relatorio', 'lineIndex' => 0);
        $this->_badString = array('&', '<', '>', "'", '"', 'ª', 'º', '¿');
        $this->_espapedString = array('&amp;', '&lt;', '&gt;', '&apos;', '&quot;', '', '', '');
        $this->_memoryManager = Zend_Memory::factory('none');
        $this->_memObject = $this->_memoryManager->create();
        $this->_numColumns = 1;
        if (is_array($options)) {
            $options = array_merge($default, $options);
        } else {
            $options = $default;
        }
        foreach ($options as $key => $value) {
            $this->{'_' . $key} = $value;
        }
        $this->_objStyles = array('FontName', 'FontSize', 'FontColor', 'FontBold', 'FontItalic', 'TextDecoration', 'BackgroundColor', 'BorderTop', 'BorderLeft', 'BorderRight', 'BorderBottom', 'TextAlign', 'Type');
        $this->_alignArray = array('L' => 'Left', 'R' => 'Right', 'C' => 'Center');
        $this->_estruturaAntes = '<?xml version="1.0" encoding="UTF-8"?>
    <?mso-application progid="Excel.Sheet"?>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:html="http://www.w3.org/TR/REC-html40">
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
    <Author>TA</Author>
    <LastAuthor>TA</LastAuthor>
    <Created>' . date('Y-m-d') . 'T' . date('H:i:s') . 'Z</Created>
    <Company>TA</Company>
    <Version>11.5606</Version>
    </DocumentProperties>
    <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
    <AllowPNG/>
    </OfficeDocumentSettings>
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
    <WindowHeight>9345</WindowHeight>
    <WindowWidth>11340</WindowWidth>
    <WindowTopX>480</WindowTopX>
    <WindowTopY>60</WindowTopY>
    <ProtectStructure>False</ProtectStructure>
    <ProtectWindows>False</ProtectWindows>
    </ExcelWorkbook>
    <Styles>
    <Style ss:ID="Default" ss:Name="Normal">
    <Alignment ss:Vertical="Bottom"/>
    <Borders/>
    <Font/>
    <Interior/>
    <NumberFormat/>
    <Protection/>
    </Style>
    <Style ss:ID="Title">
    <Font x:Family="Swiss" ss:Bold="1"/>
    </Style>
    <Style ss:ID="String">
        <Font ss:FontName="Arial" ss:Size="7" ss:Color="#000000"/>
        <Alignment ss:Horizontal="Left" ss:Indent="0"/>    
    </Style>
    <Style ss:ID="Numeric">

    </Style>
    <Style ss:ID="Integer"></Style>
    <Style ss:ID="Date">
    <NumberFormat ss:Format="Short Date"/>
    </Style>
    <Style ss:ID="DateTime">
    <NumberFormat ss:Format="d/m/yy\\ h:mm;@"/>
    </Style>
    <Style ss:ID="Time">
    <NumberFormat ss:Format="Short Time"/>
    </Style>
    <Style ss:ID="NumberTime">
    <NumberFormat ss:Format="[hh]:mm:ss"/>
    </Style>
    TaStyles
    </Styles>
    <Worksheet ss:Name="titleFile">
    <Table ss:ExpandedColumnCount="columnQuantity" ss:ExpandedRowCount="rowQuantity" x:FullColumns="1" x:FullRows="1">
    columns';
        $this->_estruturaDepois = '
    </Table>
    <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
    <PageSetup>
        <Header x:Margin="0.49212598499999999"/>
        <Footer x:Margin="0.49212598499999999"/>
        <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996" x:Right="0.78740157499999996" x:Top="0.984251969"/>
    </PageSetup>
    <Print>
        <ValidPrinterInfo/>
        <PaperSizeIndex>9</PaperSizeIndex>
        <HorizontalResolution>600</HorizontalResolution>
        <VerticalResolution>600</VerticalResolution>
    </Print>
    <Selected/>
    <Panes>
        <Pane>
        <Number>3</Number>
        <ActiveRow>12</ActiveRow>
        <ActiveCol>6</ActiveCol>
        </Pane>
    </Panes>
    <ProtectObjects>False</ProtectObjects>
    <ProtectScenarios>False</ProtectScenarios>
    </WorksheetOptions>
    </Worksheet>
    <Worksheet ss:Name="Plan2">
    <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
    x:FullRows="1" ss:DefaultRowHeight="15">
    </Table>
    <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
    <PageSetup>
        <Header x:Margin="0.49212598499999999"/>
        <Footer x:Margin="0.49212598499999999"/>
        <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996" x:Right="0.78740157499999996" x:Top="0.984251969"/>
    </PageSetup>
    <ProtectObjects>False</ProtectObjects>
    <ProtectScenarios>False</ProtectScenarios>
    </WorksheetOptions>
    </Worksheet>
    <Worksheet ss:Name="Plan3">
    <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
    x:FullRows="1" ss:DefaultRowHeight="15">
    </Table>
    <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
    <PageSetup>
        <Header x:Margin="0.49212598499999999"/>
        <Footer x:Margin="0.49212598499999999"/>
        <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996" x:Right="0.78740157499999996" x:Top="0.984251969"/>
    </PageSetup>
    <ProtectObjects>False</ProtectObjects>
    <ProtectScenarios>False</ProtectScenarios>
    </WorksheetOptions>
    </Worksheet>
    </Workbook>
    ';
        $this->_lineIndex = 0;
        $this->_memObject->value = '';
        $this->_cellType = array('NumberTime' => 'DateTime', 'Numbertime' => 'DateTime', 'Time' => 'DateTime', 'Datetime' => 'DateTime', 'DateTime' => 'DateTime', 'Date' => 'DateTime', 'Number' => 'Number', 'Integer' => 'Number', 'Numeric' => 'Number', 'String' => 'String');
        try {
            $this->_name = 'Report_Excel_' . time() . '.xml';
            $file = new ZendT_File($this->_name);
            $this->_fileName = $file->getFilename();
            if (!$this->_fileName) {
                throw new ZendT_Exception('Impossivel criar aquivo', '2');
            }
            //$this->_fileStream = fopen($this->_fileName, 'r+');
        } catch (Exception $e) {
            throw new ZendT_Exception($e->getMessage(), $e->getCode());
        }
    }