Przemek
Przemek

Reputation: 6700

Changing the size of cell borders in PHPExcel

PHPExcel border styles are defined as constants in PHPExcel_Style_Border class. The solid ones are BORDER_THIN, BORDER_MEDIUM and BORDER_THICK. However, the medium and thick ones are way too thick for my needs. Is there a way to manually set the border thickness?

Upvotes: 2

Views: 5502

Answers (1)

Mark Baker
Mark Baker

Reputation: 212402

PHPExcel border styles are defined to mimic those available in MS Excel itself The ECMA OfficeOpenXML specification (3rd Edition) defines available border styles in the ST_BorderStyle section of the document (section 18.18.3, pages 2671-2673) and defined in the xsd as:

<xsd:simpleType name="ST_BorderStyle">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="none"/>
    <xsd:enumeration value="thin"/>
    <xsd:enumeration value="medium"/>
    <xsd:enumeration value="dashed"/>
    <xsd:enumeration value="dotted"/>
    <xsd:enumeration value="thick"/>
    <xsd:enumeration value="double"/>
    <xsd:enumeration value="hair"/>
    <xsd:enumeration value="mediumDashed"/>
    <xsd:enumeration value="dashDot"/>
    <xsd:enumeration value="mediumDashDot"/>
    <xsd:enumeration value="dashDotDot"/>
    <xsd:enumeration value="mediumDashDotDot"/>
    <xsd:enumeration value="slantDashDot"/>
</xsd:restriction>

This follows the list of border styles defined for the BIFF file format, and I can't find any provision for defining custom styling or sizes.

EDIT

The Complex Border style simply adds colour information to the formatting

<xsd:complexType name="CT_Border">
    <xsd:sequence>
        <xsd:element name="start" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="end" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="top" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="bottom" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="diagonal" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="vertical" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="horizontal" type="CT_BorderPr" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
    <xsd:attribute name="diagonalUp" type="xsd:boolean" use="optional"/>
    <xsd:attribute name="diagonalDown" type="xsd:boolean" use="optional"/>
    <xsd:attribute name="outline" type="xsd:boolean" use="optional" default="true"/>
</xsd:complexType>
<xsd:complexType name="CT_BorderPr">
    <xsd:sequence>
        <xsd:element name="color" type="CT_Color" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
    <xsd:attribute name="style" type="ST_BorderStyle" use="optional" default="none"/>
</xsd:complexType>

Upvotes: 3

Related Questions