当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Style::getAlignment方法代码示例

本文整理汇总了PHP中PHPExcel_Style::getAlignment方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style::getAlignment方法的具体用法?PHP PHPExcel_Style::getAlignment怎么用?PHP PHPExcel_Style::getAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Style的用法示例。


在下文中一共展示了PHPExcel_Style::getAlignment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: propertyBeginBind

 /**
  * Property Begin Bind
  *
  * If no PHPExcel_Style_Alignment has been bound to PHPExcel_Style then bind this one. Return the actual bound one.
  *
  * @return PHPExcel_Style_Alignment
  */
 private function propertyBeginBind()
 {
     if (!isset($this->_parent)) {
         return $this;
     }
     // I am already bound
     if ($this->_parent->propertyIsBound($this->_parentPropertyName)) {
         return $this->_parent->getAlignment();
     }
     // Another one is already bound
     $this->_parent->propertyCompleteBind($this, $this->_parentPropertyName);
     // Bind myself
     $this->_parent = null;
     return $this;
 }
开发者ID:teungri,项目名称:RequirementsApp,代码行数:22,代码来源:Alignment.php

示例2: _createCSSStyle

 /**
  * Create CSS style
  *
  * @param	PHPExcel_Style		$pStyle			PHPExcel_Style
  * @return	array
  */
 private function _createCSSStyle(PHPExcel_Style $pStyle)
 {
     // Construct CSS
     $css = '';
     // Create CSS
     $css = array_merge($this->_createCSSStyleAlignment($pStyle->getAlignment()), $this->_createCSSStyleBorders($pStyle->getBorders()), $this->_createCSSStyleFont($pStyle->getFont()), $this->_createCSSStyleFill($pStyle->getFill()));
     // Return
     return $css;
 }
开发者ID:adit-gudhel,项目名称:simpus-dev,代码行数:15,代码来源:HTML.php

示例3: _writeCellStyleDxf

 /**
  * Write Cell Style Dxf
  *
  * @param 	PHPExcel_Shared_XMLWriter 		$objWriter 		XML Writer
  * @param 	PHPExcel_Style					$pStyle			Style
  * @throws 	Exception
  */
 private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
 {
     // dxf
     $objWriter->startElement('dxf');
     // font
     $this->_writeFont($objWriter, $pStyle->getFont());
     // numFmt
     $this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
     // fill
     $this->_writeFill($objWriter, $pStyle->getFill());
     // alignment
     $objWriter->startElement('alignment');
     $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
     $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
     $textRotation = 0;
     if ($pStyle->getAlignment()->getTextRotation() >= 0) {
         $textRotation = $pStyle->getAlignment()->getTextRotation();
     } else {
         if ($pStyle->getAlignment()->getTextRotation() < 0) {
             $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
         }
     }
     $objWriter->writeAttribute('textRotation', $textRotation);
     $objWriter->endElement();
     // border
     $this->_writeBorder($objWriter, $pStyle->getBorders());
     // protection
     if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
         $objWriter->startElement('protection');
         if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
             $objWriter->writeAttribute('locked', $pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
         }
         if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
             $objWriter->writeAttribute('hidden', $pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
         }
         $objWriter->endElement();
     }
     $objWriter->endElement();
 }
开发者ID:echoOly,项目名称:php_base,代码行数:46,代码来源:Style.php

示例4: _createCSSStyle

 /**
  * Create CSS style
  * 
  * @param	PHPExcel_Style 		$pStyle			PHPExcel_Style
  * @return	string
  */
 private function _createCSSStyle(PHPExcel_Style $pStyle)
 {
     // Construct HTML
     $html = '';
     // Create CSS
     $html .= '      .style' . $pStyle->getHashCode() . ' {' . "\r\n";
     $html .= $this->_createCSSStyleAlignment($pStyle->getAlignment());
     $html .= $this->_createCSSStyleFont($pStyle->getFont());
     $html .= $this->_createCSSStyleBorders($pStyle->getBorders());
     $html .= $this->_createCSSStyleFill($pStyle->getFill());
     $html .= '      }' . "\r\n";
     // Return
     return $html;
 }
开发者ID:laiello,项目名称:myopensources,代码行数:20,代码来源:HTML.php

示例5: array


//.........这里部分代码省略.........
					$j= $i + 1;
					$this->objPHPExcel->getActiveSheet()->setTitle("Sheet $j");

					$cells= array();
					
					$cells= $sheet->getCells();

					foreach($cells as $cellarray){

						$cell= new Cell();
						foreach ($cellarray as $cell){

						
							$col= $cell->getDataColumn();
							$row= $cell->getDataRow();
							$row++;
							
							$data= $cell->getFormula();
//							$this->objPHPExcel= new PHPExcel();
							
							
							$fontId= $cell->getFontStyleId();
							$fontStyle= new FontStyle();
							$fontStyle= $this->book->getFontStyle($fontId);
							$fontName= $fontStyle->getFontName();	
							$fcolor= substr($fontStyle->getFontColor(),1);
							
							if ($fcolor == "000000"){ 
								//echo "$row $col $fcolor<hr>";
							 	$ncolor= new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
							 	$ncolor->setRGB($fcolor);							 	
							}
							else{
								//echo "$row $col $fcolor<hr>";
								$ncolor= new PHPExcel_Style_Color();
								$ncolor->setRGB($fcolor);				
							}	
							
							$style= new PHPExcel_Style();
							$style->getFont()->setColor($ncolor);
							$style->getFont()->setName($fontName);
							$style->getFont()->setBold($fontStyle->getFontBold()== 1);
							$style->getFont()->setItalic($fontStyle->getFontItalic()==1);
							$style->getFont()->setSize($fontStyle->getFontSize());
							
							
							$HzAlign= PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
							
							switch ($fontStyle->fontHAlign){
								
								case 0:									
									$HzAlign= PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
									break;
								case 1:									
									$HzAlign= PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
									break;
								case 2:									
									$HzAlign= PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
									break;
								case 3:									
									$HzAlign= PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
									break;								
							}
				
							$VlAlign= PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
							
							switch ($fontStyle->fontVAlign){
								
								case 0:									
									$VlAlign= PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
									break;
								case 1:									
									$VlAlign= PHPExcel_Style_Alignment::VERTICAL_CENTER;
									break;
								case 2:									
									$VlAlign= PHPExcel_Style_Alignment::VERTICAL_TOP;							
															
							}						
							
							$style->getAlignment()->setHorizontal($HzAlign);
							$style->getAlignment()->setVertical($VlAlign);
							
							
							if ($fontStyle->getFontUnderline()!= 0){
								$style->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
							}
														
							$this->objPHPExcel->getActiveSheet()->duplicateStyle($style, PHPExcel_Cell::stringFromColumnIndex($col) . $row);
							$this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col, $row)->setValueExplicit($data, PHPExcel_Cell_DataType::dataTypeForValue($data));							
											
						}
						
					}
						$i++;

					}

				}

		}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:ExportController.class.php

示例6: _readDefault

    /**
	 * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record.
	 */
    private function _readDefault()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        //		$recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
    }
    /**
	 *	The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions,
	 *		this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
	 */
    private function _readNote()
    {
        //		echo '<b>Read Cell Annotation</b><br>';
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        if ($this->_readDataOnly) {
            return;
        }
        $cellAddress = $this->_readBIFF8CellAddress(substr($recordData, 0, 4));
        if ($this->_version == self::XLS_BIFF8) {
            $noteObjID = self::_GetInt2d($recordData, 6);
            $noteAuthor = self::_readUnicodeStringLong(substr($recordData, 8));
            $noteAuthor = $noteAuthor['value'];
            //			echo 'Note Address=',$cellAddress,'<br>';
            //			echo 'Note Object ID=',$noteObjID,'<br>';
            //			echo 'Note Author=',$noteAuthor,'<hr />';
            //
            $this->_cellNotes[$noteObjID] = array('cellRef' => $cellAddress, 'objectID' => $noteObjID, 'author' => $noteAuthor);
        } else {
            $extension = false;
            if ($cellAddress == '$B$65536') {
                //	If the address row is -1 and the column is 0, (which translates as $B$65536) then this is a continuation
                //		note from the previous cell annotation. We're not yet handling this, so annotations longer than the
                //		max 2048 bytes will probably throw a wobbly.
                $row = self::_GetInt2d($recordData, 0);
                $extension = true;
                $cellAddress = array_pop(array_keys($this->_phpSheet->getComments()));
            }
            //			echo 'Note Address=',$cellAddress,'<br>';
            $cellAddress = str_replace('$', '', $cellAddress);
            $noteLength = self::_GetInt2d($recordData, 4);
            $noteText = trim(substr($recordData, 6));
            //			echo 'Note Length=',$noteLength,'<br>';
            //			echo 'Note Text=',$noteText,'<br>';
            if ($extension) {
                //	Concatenate this extension with the currently set comment for the cell
                $comment = $this->_phpSheet->getComment($cellAddress);
                $commentText = $comment->getText()->getPlainText();
                $comment->setText($this->_parseRichText($commentText . $noteText));
            } else {
                //	Set comment for the cell
                $this->_phpSheet->getComment($cellAddress)->setText($this->_parseRichText($noteText));
            }
        }
    }
    /**
	 *	The TEXT Object record contains the text associated with a cell annotation.
	 */
    private function _readTextObject()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        if ($this->_readDataOnly) {
            return;
        }
        // recordData consists of an array of subrecords looking like this:
        //	grbit: 2 bytes; Option Flags
        //	rot: 2 bytes; rotation
        //	cchText: 2 bytes; length of the text (in the first continue record)
        //	cbRuns: 2 bytes; length of the formatting (in the second continue record)
        // followed by the continuation records containing the actual text and formatting
        $grbitOpts = self::_GetInt2d($recordData, 0);
        $rot = self::_GetInt2d($recordData, 2);
        $cchText = self::_GetInt2d($recordData, 10);
        $cbRuns = self::_GetInt2d($recordData, 12);
        $text = $this->_getSplicedRecordData();
        $this->_textObjects[$this->textObjRef] = array('text' => substr($text["recordData"], $text["spliceOffsets"][0] + 1, $cchText), 'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns), 'alignment' => $grbitOpts, 'rotation' => $rot);
        //		echo '<b>_readTextObject()</b><br>';
        //		var_dump($this->_textObjects[$this->textObjRef]);
        //		echo '<br>';
    }
    /**
	 * Read BOF
	 */
    private function _readBof()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        // offset: 2; size: 2; type of the following data
        $substreamType = self::_GetInt2d($recordData, 2);
//.........这里部分代码省略.........
开发者ID:Arikito,项目名称:webking.xt,代码行数:101,代码来源:Excel5.php


注:本文中的PHPExcel_Style::getAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。