66 lines
1.8 KiB
PHP
Raw Normal View History

2014-05-07 21:27:51 +02:00
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
2014-05-08 12:58:44 +07:00
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
2015-12-05 21:25:59 +04:00
* @copyright 2010-2015 PHPWord contributors
2014-05-08 12:58:44 +07:00
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
2014-05-07 21:27:51 +02:00
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle;
/**
* TextBox style writer
*
2014-05-08 12:58:44 +07:00
* @since 0.11.0
2014-05-07 21:27:51 +02:00
*/
class TextBox extends Frame
2014-05-07 21:27:51 +02:00
{
2014-05-08 22:42:56 +07:00
/**
* Writer inner margin.
*
* @return void
2014-05-08 22:42:56 +07:00
*/
public function writeInnerMargin()
{
$style = $this->getStyle();
2014-05-15 14:41:08 +07:00
if (!$style instanceof TextBoxStyle || !$style->hasInnerMargins()) {
2014-05-08 22:42:56 +07:00
return;
}
$xmlWriter = $this->getXmlWriter();
$margins = implode(', ', $style->getInnerMargin());
2014-05-08 22:42:56 +07:00
$xmlWriter->writeAttribute('inset', $margins);
}
2014-05-08 19:25:29 +07:00
/**
* Writer border.
*
* @return void
2014-05-08 19:25:29 +07:00
*/
public function writeBorder()
2014-05-08 19:25:29 +07:00
{
$style = $this->getStyle();
if (!$style instanceof TextBoxStyle) {
return;
2014-05-07 21:27:51 +02:00
}
$xmlWriter = $this->getXmlWriter();
$xmlWriter->startElement('v:stroke');
$xmlWriter->writeAttributeIf($style->getBorderSize() !== null, 'weight', $style->getBorderSize() . 'pt');
$xmlWriter->writeAttributeIf($style->getBorderColor() !== null, 'color', $style->getBorderColor());
$xmlWriter->endElement(); // v:stroke
2014-05-07 21:27:51 +02:00
}
}