public static function buildBorder($string, Border $border)
    {
        switch ($border->getType()) {
            case Border::TYPE_UNDERLINE:
                $result = self::buildUnderline($string, $border);
                break;
            case Border::TYPE_FRAME:
                $result = self::buildFrame($string, $border);
                break;
            default:
                throw new Exception('Unknown border type ' . $border->getType());
        }

        return $result;
    }