0

I am using the phpdocx library to create pie chart diagrams in a .docx file. The (only) respective part I found regarding the color scheme is

<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <mc:Choice xmlns:c14="http://schemas.microsoft.com/office/drawing/2007/8/2/chart" Requires="c14">
        <c14:style val="102"/>
    </mc:Choice>
    <mc:Fallback>
        <c:style val="2"/>
    </mc:Fallback>
</mc:AlternateContent>

Is there any primary source where the implication of these settings are documented and/or am I able to define them on my own?

Thanks and best!

Adrian Föder
  • 770
  • 1
  • 7
  • 22

1 Answers1

0

OK, found it out. Assuming a pie chart, the extracted docx contains, in word/charts/(somefilename).xml, under the element path c:chartSpace/c:chart/c:plotArea/c:pie[3D]Chart/c:ser/, the following relevant sections:

<c:val>
    <c:numRef>
        <c:f>0</c:f>
        <c:numCache>
            <c:formatCode>General</c:formatCode>
            <c:ptCount val="3"/>
            <c:pt idx="0">
                <c:v>41.75</c:v>
            </c:pt>
            <c:pt idx="1">
                <c:v>35.71</c:v>
            </c:pt>
            <c:pt idx="2">
                <c:v>22.52</c:v>
            </c:pt>
        </c:numCache>
    </c:numRef>
</c:val>

Such a c:pt seems to mean data point maybe.

Anyway, as a couple of siblings to this c:val node, there is

<c:dPt>
    <c:idx val="0"/>
    <c:spPr>
        <a:solidFill>
            <a:srgbClr val="004586"/>
        </a:solidFill>
        <a:ln>
            <a:noFill/>
        </a:ln>
    </c:spPr>
</c:dPt>
<c:dPt>
    <c:idx val="1"/>
    <c:spPr>
        <a:solidFill>
            <a:srgbClr val="ff420e"/>
        </a:solidFill>
        <a:ln>
            <a:noFill/>
        </a:ln>
    </c:spPr>
</c:dPt>
<c:dPt>
    <c:idx val="2"/>
    <c:spPr>
        <a:solidFill>
            <a:srgbClr val="ffd320"/>
        </a:solidFill>
        <a:ln>
            <a:noFill/>
        </a:ln>
    </c:spPr>
</c:dPt>

The idx elements/attributes apparently refer to each other, and the solidFill/srgbClr seems to define the actual color.

HTH.

Adrian Föder
  • 770
  • 1
  • 7
  • 22