Add a PreserveText Element

@param string $text
@param mixed $styleFont
@param mixed $styleParagraph
@return PHPWord_Section_Footer_PreserveText
16306
public function addPreserveText($text, $styleFont = null, $styleParagraph = null) {
		if($this->_insideOf == 'footer' || $this->_insideOf == 'header') {
			$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
			$this->_elementCollection[] = $ptext;
			return $ptext;
		} else {
			trigger_error('addPreserveText only supported in footer/header.');
		}
	}
343164
public function addText($text, $pos = '20x20', $padding = 0, $fontColor = '#fff', $fontSize = 12, $angle = 0, $font = null)
		# Author:     Jarrod Oberto
		# Date:       18-11-09
		# Purpose:    Add text to an image
		# Param in:
		# Param out:
		# Reference:  http://php.net/manual/en/function.imagettftext.php
		# Notes:      Make sure you supply the font.
		#
	{

		// *** Convert color
		$rgbArray = $this->formatColor($fontColor);
		$r = $rgbArray['r'];
		$g = $rgbArray['g'];
		$b = $rgbArray['b'];

		// *** Get text font
		$font = $this->getTextFont($font);

		// *** Get text size
		$textSizeArray = $this->getTextSize($fontSize, $angle, $font, $text);
		$textWidth = $textSizeArray['width'];
		$textHeight = $textSizeArray['height'];

		// *** Find co-ords to place text
		$posArray = $this->calculatePosition($pos, $padding, $textWidth, $textHeight, false);
		$x = $posArray['width'];
		$y = $posArray['height'];

		$fontColor = imagecolorallocate($this->imageResized, $r, $g, $b);

		// *** Add text
		imagettftext($this->imageResized, $fontSize, $angle, $x, $y, $fontColor, $font, $text);
	}
595160
public function do_text(
        $text,
        $offsetX = 0,
        $offsetY = 0,
        $opacity = 1.0,
        $color = 0x000000,
        $size = 12,
        $font_file = null
    ) {
        $draw = new \ImagickDraw();
        $textColor = sprintf('rgb(%u,%u,%u)', ($color >> 16) & 0xFF, ($color >> 8) & 0xFF, $color & 0xFF);
        $draw->setFillColor(new \ImagickPixel($textColor));
        if ($font_file) {
            $draw->setFont($this->alias->resolve($font_file));
        }
        $draw->setFontSize($size);
        $draw->setFillOpacity($opacity);
        $draw->setGravity(\Imagick::GRAVITY_NORTHWEST);
        $this->_image->annotateImage($draw, $offsetX, $offsetY, 0, $text);
        $draw->destroy();

        return $this;
    }
117808
private function applyStyle($style, $text)
    {
        list($startCode, $endCode) = self::$styles[$style];

        return $startCode . $text . $endCode;
    }
105880
public function addTextByDirection($text, $direction = self::Top, $fontSize = 16, $color = '#000', $fontFamily = 5) {
		list($x, $y) = $this->getPointByDirection($direction);
		return $this->addText($text, $x, $y, $fontSize, $color, $fontFamily);
	}
1294797
public function apply($text)
    {
        $foreground = null;
        $background = null;

        if($this->foreground)
            $foreground = 'color: ' . $this->foreground . ';';

        if($this->background)
            $background = 'background: ' . $this->background . ';';

        $dom = '<span style="'.$foreground.$background.'">' . $text . '</span>';

        return $dom;
    }
463878
public TextBuilder parStyledContent(final String text, final TextStyle ts) {
        return this.par().styledSpan(text, ts);
    }
924536
public static function colorify($text)
    {
        $htmldecoded = htmlspecialchars($text);
        $boldSqBracket = preg_replace('/\[([a-zA-Z]+)\]/', '[<span style="color: #000; font-weight: bold;">${1}</span>]', $htmldecoded);
        $boldBracket = preg_replace('/\{([a-zA-Z_ ]+)\}/', '{<span style="color: #000; font-weight: bold;">${1}</span>}', $boldSqBracket);
        return str_replace(self::$_search, self::$_replace, $boldBracket);
    }
365378
public function addIconToText($text, OptionsParser $options)
    {
        $icon = $options->consume('icon');
        $align = $options->consume('icon-align');

        if (!$icon) {
            return [$text, $options];
        }

        $icon = $this->icon($icon);

        if (empty($text)) {
            $text = $icon;
        } elseif ($align === 'right') {
            $text = sprintf('%s %s', $text, $icon);
        } else {
            $text = sprintf('%s %s', $icon, $text);
        }

        return [$text, $options];
    }
5334
public function createParagraph($text = null, array $attributes = [])
    {
        $paragraph = new Paragraph();

        if (count($attributes)) {
            foreach ($attributes as $name => $value) {
                $paragraph->attributes->addAttribute($name, $value);
            }
        }

        if ($text instanceof Element) {
            $paragraph->childNodes->push($text);
        } elseif ( ! is_null($text)) {
            $paragraph->textContent->push($text);
        }

        $this->childNodes->push($paragraph);

        return $this->childNodes->last();
    }
512486
public function createTextRun($styleParagraph = null) {
		$textRun = new PHPWord_Section_TextRun($styleParagraph);
		$this->_elementCollection[] = $textRun;
		return $textRun;
	}
816522
public function addTitleAddon($text, array $attributes = array())
    {
        $backlink_text                  = $this->_getConfigOrDefault('backlink_text');
        $backlink_attributes            = array();
        $backlink_attributes['title']   = '';

        // permalink links class
        $cfg_permalink_class            = $this->_getConfigOrDefault('permalink_class');
        if (isset($attributes['permalink_class'])) {
            $backlink_attributes['class'] = $attributes['permalink_class'];
            unset($attributes['permalink_class']);
        } else {
            $backlink_attributes['class'] = $cfg_permalink_class;
        }

        // toc backlink id
        $cfg_permalink_title            = $this->_getConfigOrDefault('permalink_mask_title');
        if (isset($attributes['id'])) {
            $backlink_attributes['href'] = '#'.$attributes['id'];

            if (isset($attributes['permalink_title'])) {
                $backlink_attributes['title'] .= $attributes['permalink_title'];
                unset($attributes['permalink_title']);

            } elseif (isset($attributes['permalink_mask_title'])) {
                $backlink_attributes['title'] .= str_replace('%%', '#'.$attributes['id'], $attributes['permalink_mask_title']);
                unset($attributes['permalink_mask_title']);

            } else {
                $backlink_attributes['title'] .= str_replace('%%', '#'.$attributes['id'], $cfg_permalink_title);
            }
        }

        // toc backlink id
        $cfg_toc_id                     = $this->_getConfigOrDefault('toc_id');
        $cfg_toc_title                  = $this->_getConfigOrDefault('toc_backlink_title');
        $cfg_backlink_onclick_mask      = $this->_getConfigOrDefault('backlink_onclick_mask');
        $cfg_permalink_title_separator  = $this->_getConfigOrDefault('permalink_title_separator');

        if (isset($attributes['permalink_title_separator'])) {
            $permalink_title_separator = $attributes['permalink_title_separator'];
            unset($attributes['permalink_title_separator']);
        } else {
            $permalink_title_separator = $cfg_permalink_title_separator;
        }

        if (isset($attributes['toc_id'])) {
            $toc_id = $attributes['toc_id'];
            unset($attributes['toc_id']);

            if (isset($attributes['toc_backlink_title'])) {
                $backlink_attributes['title'] .= $permalink_title_separator.$attributes['toc_backlink_title'];
                unset($attributes['toc_back_title']);
            } else {
                $backlink_attributes['title'] .= $permalink_title_separator.$cfg_toc_title;
            }

        } elseif (!empty($cfg_toc_id) && !empty($cfg_toc_title)) {
            $toc_id = $cfg_toc_id;
            $backlink_attributes['title'] .= $permalink_title_separator.$cfg_toc_title;
        }

        if (isset($attributes['backlink_onclick_mask'])) {
            $backlink_onclick_mask = $attributes['backlink_onclick_mask'];
            unset($attributes['backlink_onclick_mask']);
        } else {
            $backlink_onclick_mask = $cfg_backlink_onclick_mask;
        }
        $backlink_attributes['onclick'] = str_replace('%%', $toc_id, $backlink_onclick_mask);

        // add-on
        if (!empty($backlink_text) && !empty($backlink_attributes['title'])) {
            $text .= $this->buildTag('link', $backlink_text, $backlink_attributes);
        }

        return $text;
    }
77324
public function write(&$text)
    {
        //Parse the script information
        $styles = $this->_parseStyles($text);

        //Prepend the script information
        $text = $styles.$text;

        return $this;
    }
1013921
public static function addLinkStyle($styleName, $styles) {
		if(!array_key_exists($styleName, self::$_styleElements)) {
			$style = new PHPWord_Style_Font('link');
			foreach($styles as $key => $value) {
				if(substr($key, 0, 1) != '_') {
					$key = '_'.$key;
				}
				$style->setStyleValue($key, $value);
			}
			
			self::$_styleElements[$styleName] = $style;
		}
	}
594
public function error(string $text, array $style = []): string
    {
        return $this->line($text, ['fg' => static::RED] + $style);
    }
1066627
public function _addFont(PHPExcel_Style_Font $font)
	{
		$fontHashCode = $font->getHashCode();
		if(isset($this->_addedFonts[$fontHashCode])){
			$fontIndex = $this->_addedFonts[$fontHashCode];
		} else {
			$countFonts = count($this->_fontWriters);
			$fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1;

			$fontWriter = new PHPExcel_Writer_Excel5_Font($font);
			$fontWriter->setColorIndex($this->_addColor($font->getColor()->getRGB()));
			$this->_fontWriters[] = $fontWriter;

			$this->_addedFonts[$fontHashCode] = $fontIndex;
		}
		return $fontIndex;
	}
238397
public function addText($text) {
      if (is_string($text))
          $text = new BaMLText($text);
      if (!($text instanceof BaMLText)) 
          throw new \CatapultApiException("You can only add type BaMLAttribute or array..");
      
      $this->text = $this->text . $text;
    }