source: sourcecode/application/libraries/PHPExcel/Writer/Excel2007/RelsVBA.php @ 1

Last change on this file since 1 was 1, checked in by dungnv, 11 years ago
File size: 2.5 KB
Line 
1<?php
2/**
3 * PHPExcel
4 *
5 * Copyright (c) 2006 - 2014 PHPExcel
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20 *
21 * @category   PHPExcel
22 * @package    PHPExcel_Writer_Excel2007
23 * @copyright  Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
24 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25 * @version     1.8.0, 2014-03-02
26 */
27
28
29/**
30 * PHPExcel_Writer_Excel2007_RelsVBA
31 *
32 * @category   PHPExcel
33 * @package    PHPExcel_Writer_Excel2007
34 * @copyright  Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
35 */
36class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_WriterPart
37{
38        /**
39         * Write relationships for a signed VBA Project
40         *
41         * @param       PHPExcel        $pPHPExcel
42         * @return      string          XML Output
43         * @throws      PHPExcel_Writer_Exception
44         */
45        public function writeVBARelationships(PHPExcel $pPHPExcel = null){
46                // Create XML writer
47                $objWriter = null;
48                if ($this->getParentWriter()->getUseDiskCaching()) {
49                        $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
50                } else {
51                        $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
52                }
53
54                // XML header
55                $objWriter->startDocument('1.0','UTF-8','yes');
56
57                // Relationships
58                $objWriter->startElement('Relationships');
59                $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
60                $objWriter->startElement('Relationship');
61                $objWriter->writeAttribute('Id', 'rId1');
62                $objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature');
63                $objWriter->writeAttribute('Target', 'vbaProjectSignature.bin');
64                $objWriter->endElement();//Relationship
65                $objWriter->endElement();//Relationships
66
67                // Return
68                return $objWriter->getData();
69
70        }
71
72}
Note: See TracBrowser for help on using the repository browser.