>  기사  >  데이터 베이스  >  php生成excel列名,超过26列大于Z的方法

php生成excel列名,超过26列大于Z的方法

WBOY
WBOY원래의
2016-06-07 16:38:401146검색

这是phpExcel类中的方法。今天查到了,记录一下备忘。 public static function stringFromColumnIndex($pColumnIndex = 0){//Using a lookup cache adds a slight memory overhead, but boosts speed//caching using a static within the method is faster t

这是phpExcel类中的方法。今天查到了,记录一下备忘。

public static function stringFromColumnIndex($pColumnIndex = 0)
	{
		//	Using a lookup cache adds a slight memory overhead, but boosts speed
		//	caching using a static within the method is faster than a class static,
		//		though it's additional memory overhead
		static $_indexCache = array();
		if (!isset($_indexCache[$pColumnIndex])) {
			// Determine column string
			if ($pColumnIndex 
<p>将列的数字序号转成字母使用:</p>
<p>PHPExcel_Cell::stringFromColumnIndex($i); // 从o开始</p>
<p>将列的字母转成数字序号使用:</p>
<p>PHPExcel_Cell::columnIndexFromString(‘AA’);</p>
    <p class="copyright">
        原文地址:php生成excel列名,超过26列大于Z的方法, 感谢原作者分享。
    </p>
    
    


성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.