cvs: pear /Spreadsheet_Excel_Writer/Writer Format.php
| From: | Xavier Noguer Gallego | Date: | Wed, 09 Nov 2005 00:29:37 +0000 |
| Subject: | cvs: pear /Spreadsheet_Excel_Writer/Writer Format.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-36172@lists.php.net to get a copy of this message | ||
xnoguer Tue Nov 8 19:29:37 2005 EDT
Modified files:
/pear/Spreadsheet_Excel_Writer/Writer Format.php
Log:
adding new methods setVAlign() and setHAlign() (request #2480)
http://cvs.php.net/diff.php/pear/Spreadsheet_Excel_Writer/Writer/Format.php?r1=1.25&r2=1.26&ty=u
Index: pear/Spreadsheet_Excel_Writer/Writer/Format.php
diff -u pear/Spreadsheet_Excel_Writer/Writer/Format.php:1.25
pear/Spreadsheet_Excel_Writer/Writer/Format.php:1.26
--- pear/Spreadsheet_Excel_Writer/Writer/Format.php:1.25 Tue Sep 27 04:55:23 2005
+++ pear/Spreadsheet_Excel_Writer/Writer/Format.php Tue Nov 8 19:29:35 2005
@@ -641,6 +641,80 @@
}
/**
+ * Set cell horizontal alignment.
+ *
+ * @access public
+ * @param string $location alignment for the cell ('left', 'right', etc...).
+ */
+ function setHAlign($location)
+ {
+ if (preg_match("/\d/",$location)) {
+ return; // Ignore numbers
+ }
+
+ $location = strtolower($location);
+
+ if ($location == 'left') {
+ $this->_text_h_align = 1;
+ }
+ if ($location == 'centre') {
+ $this->_text_h_align = 2;
+ }
+ if ($location == 'center') {
+ $this->_text_h_align = 2;
+ }
+ if ($location == 'right') {
+ $this->_text_h_align = 3;
+ }
+ if ($location == 'fill') {
+ $this->_text_h_align = 4;
+ }
+ if ($location == 'justify') {
+ $this->_text_h_align = 5;
+ }
+ if ($location == 'merge') {
+ $this->_text_h_align = 6;
+ }
+ if ($location == 'equal_space') { // For T.K.
+ $this->_text_h_align = 7;
+ }
+ }
+
+ /**
+ * Set cell vertical alignment.
+ *
+ * @access public
+ * @param string $location alignment for the cell ('top', 'vleft',
'vright', etc...).
+ */
+ function setVAlign($location)
+ {
+ if (preg_match("/\d/",$location)) {
+ return; // Ignore numbers
+ }
+
+ $location = strtolower($location);
+
+ if ($location == 'top') {
+ $this->_text_v_align = 0;
+ }
+ if ($location == 'vcentre') {
+ $this->_text_v_align = 1;
+ }
+ if ($location == 'vcenter') {
+ $this->_text_v_align = 1;
+ }
+ if ($location == 'bottom') {
+ $this->_text_v_align = 2;
+ }
+ if ($location == 'vjustify') {
+ $this->_text_v_align = 3;
+ }
+ if ($location == 'vequal_space') { // For T.K.
+ $this->_text_v_align = 4;
+ }
+ }
+
+ /**
* This is an alias for the unintuitive setAlign('merge')
*
* @access public