Mark V
1: <?php
2: namespace MOC\V\Component\Document\Component\Bridge\Repository\PhpExcel;
3:
4: use MOC\V\Component\Document\Component\Bridge\Bridge;
5: use MOC\V\Component\Document\Component\Bridge\Repository\PhpExcel;
6: use MOC\V\Component\Document\Component\IBridgeInterface;
7: use MOC\V\Component\Document\Component\Parameter\Repository\PaperOrientationParameter;
8: use MOC\V\Component\Document\Component\Parameter\Repository\PaperSizeParameter;
9:
10: /**
11: * Class Config
12: *
13: * @package MOC\V\Component\Document\Component\Bridge\Repository\PhpExcel
14: */
15: abstract class Config extends Bridge implements IBridgeInterface
16: {
17:
18: /** @var null|\PHPExcel $Source */
19: protected $Source = null;
20:
21: /**
22: * @return \PHPExcel_Cell_AdvancedValueBinder
23: */
24: public function createAdvancedValueBinder()
25: {
26:
27: return new \PHPExcel_Cell_AdvancedValueBinder();
28: }
29:
30: /**
31: * @param PaperOrientationParameter $PaperOrientation
32: *
33: * @return PhpExcel
34: */
35: public function setPaperOrientationParameter(PaperOrientationParameter $PaperOrientation)
36: {
37:
38: parent::setPaperOrientationParameter($PaperOrientation);
39: $this->Source->getActiveSheet()->getPageSetup()
40: ->setOrientation(
41: constant('\PHPExcel_Worksheet_PageSetup::ORIENTATION_'.$this->getPaperOrientationParameter())
42: );
43: return $this;
44: }
45:
46: /**
47: * @param PaperSizeParameter $PaperSize
48: *
49: * @return PhpExcel
50: */
51: public function setPaperSizeParameter(PaperSizeParameter $PaperSize)
52: {
53:
54: parent::setPaperSizeParameter($PaperSize);
55: $this->Source->getActiveSheet()->getPageSetup()
56: ->setPaperSize(
57: constant('\PHPExcel_Worksheet_PageSetup::PAPERSIZE_'.$this->getPaperSizeParameter())
58: );
59: return $this;
60: }
61:
62: /**
63: * @param \PHPExcel_Cell_IValueBinder $ValueBinder
64: */
65: protected function setConfiguration(\PHPExcel_Cell_IValueBinder $ValueBinder = null)
66: {
67:
68: \PHPExcel_Settings::setCacheStorageMethod(
69: \PHPExcel_CachedObjectStorageFactory::cache_in_memory, array('cacheTime' => 3600)
70: );
71: if (null !== $ValueBinder) {
72: \PHPExcel_Cell::setValueBinder($ValueBinder);
73: }
74: }
75: }
76: