From cc9dfb86302671f88d4ed8fdad37dcbf67619987 Mon Sep 17 00:00:00 2001 From: emhome Date: Sat, 19 Dec 2020 16:36:55 +0800 Subject: [PATCH 1/2] add/setting page element border style. --- src/PhpWord/Style/Border.php | 35 +++++++++++++++++++ .../Writer/Word2007/Style/Paragraph.php | 1 + 2 files changed, 36 insertions(+) diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index d032d07faa..8d2ca37cf8 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -22,6 +22,41 @@ */ class Border extends AbstractStyle { + /** + * Border Style Val. + * Wordprocessing Paragraphs Borders + * Specifies the style of the border. Paragraph borders can be only line borders. (Page borders can also be art borders.) Possible values are: + * @see http://officeopenxml.com/WPborders.php + * @const string + */ + const BORDER_STYLE_SINGLE = 'single'; //A single line + const BORDER_STYLE_DASH_DOT_STROKED = 'dashDotStroked'; //A line with a series of alternating thin and thick strokes + const BORDER_STYLE_DASHED = 'dashed'; //A dashed line + const BORDER_STYLE_DASH_SMALL_GAP = 'dashSmallGap'; //A dashed line with small gaps + const BORDER_STYLE_DOT_DASH = 'dotDash'; //A line with alternating dots and dashes + const BORDER_STYLE_DOT_DOT_DASH = 'dotDotDash'; //A line with a repeating dot - dot - dash sequence + const BORDER_STYLE_DOTTED = 'dotted'; //A dotted line + const BORDER_STYLE_DOUBLE = 'double'; //A double line + const BORDER_STYLE_DOUBLE_WAVE = 'doubleWave'; //A double wavy line + const BORDER_STYLE_INSET = 'inset'; //An inset set of lines + const BORDER_STYLE_NIL = 'nil'; //No border + const BORDER_STYLE_NONE = 'none'; //No border + const BORDER_STYLE_OUTSET = 'outset'; //An outset set of lines + const BORDER_STYLE_THICK = 'thick'; //A single line + const BORDER_STYLE_THICK_THIN_LARGE_GAP = 'thickThinLargeGap'; //A thick line contained within a thin line with a large-sized intermediate gap + const BORDER_STYLE_THICK_THIN_MEDIUM_GAP = 'thickThinMediumGap'; //A thick line contained within a thin line with a medium-sized intermediate gap + const BORDER_STYLE_THICK_THIN_SMALL_GAP = 'thickThinSmallGap'; //A thick line contained within a thin line with a small intermediate gap + const BORDER_STYLE_THIN_THICK_LARGE_GAP = 'thinThickLargeGap'; //A thin line contained within a thick line with a large-sized intermediate gap + const BORDER_STYLE_THIN_THICK_MEDIUM_GAP = 'thinThickMediumGap'; //A thick line contained within a thin line with a medium-sized intermediate gap + const BORDER_STYLE_THIN_THICK_SMALL_GAP = 'thinThickSmallGap'; //A thick line contained within a thin line with a small intermediate gap + const BORDER_STYLE_THIN_THICK_THINLARGE_GAP = 'thinThickThinLargeGap'; //A thin-thick-thin line with a large gap + const BORDER_STYLE_THIN_THICK_THIN_MEDIUM_GAP = 'thinThickThinMediumGap'; //A thin-thick-thin line with a medium gap + const BORDER_STYLE_THIN_THICK_THIN_SMALL_GAP = 'thinThickThinSmallGap'; //A thin-thick-thin line with a small gap + const BORDER_STYLE_THREE_D_EMBOSS = 'threeDEmboss'; //A three-staged gradient line, getting darker towards the paragraph + const BORDER_STYLE_THREE_D_ENGRAVE = 'threeDEngrave'; //A three-staged gradient like, getting darker away from the paragraph + const BORDER_STYLE_TRIPLE = 'triple'; //A triple line + const BORDER_STYLE_WAVE = 'wave'; //A wavy line + /** * Border Top Size * diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 6761608608..1e37f8443d 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -132,6 +132,7 @@ private function writeStyle() $styleWriter = new MarginBorder($xmlWriter); $styleWriter->setSizes($style->getBorderSize()); + $styleWriter->setStyles($style->getBorderStyle()); $styleWriter->setColors($style->getBorderColor()); $styleWriter->write(); From b2585dfd288f8f46dfe0b5d903bd6ba488509066 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 8 Feb 2021 22:20:00 +0100 Subject: [PATCH 2/2] move constants to simpleType --- src/PhpWord/SimpleType/Border.php | 58 +++++++++++++++++++++++++++++++ src/PhpWord/Style/Border.php | 35 ------------------- 2 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 src/PhpWord/SimpleType/Border.php diff --git a/src/PhpWord/SimpleType/Border.php b/src/PhpWord/SimpleType/Border.php new file mode 100644 index 0000000000..a73c7b4a67 --- /dev/null +++ b/src/PhpWord/SimpleType/Border.php @@ -0,0 +1,58 @@ +