- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
foreach ($child as $ch) {
if ($ch->nodeName === 'w:style') {
$sum++;
if ($ch->hasAttributes()) {
/** @var DOMAttr $attribute */
foreach ($ch->attributes as $attribute) {
if ($attribute->name === 'styleId') {
if ($attribute->value == $sTempStyle) {
/** @var DOMElement $styleNode */
foreach ($ch->childNodes as $styleNode) {
if (isset($styleNode->tagName) && $styleNode->tagName === 'w:basedOn') {
$basedOn = $styleNode->getAttribute('w:val');
$properties = $this->wordStyle2Array($basedOn, $tagName, $properties);
}
if (isset($styleNode->tagName) && $styleNode->tagName === $tagName) {
$elements = $styleNode->childNodes;
/** @var DOMElement $element */
foreach ($elements as $element) {
if (isset($element->tagName)) {
switch ($element->tagName) {
case 'w:color':
if ($element->hasAttribute('w:val')) {
$properties['color']['hex'] = '#' . $element->getAttribute
('w:val');
}
break;
case 'w:rFonts':
if ($element->hasAttribute('w:ascii')) {
$properties['font_family'] = $element->getAttribute('w:ascii');
}
break;
//кейсы - бесконечные как осень в России
}
}
}
}
}
}
}
}
}
}