Bir workround stil xf dizinleri kullanmayı olabilir için: aralığındaki tüm hücrelerin xfIndex için bu değeri ayarlamak için Sonra
$xfIndex = $activeSheet->getCell('A1')->getXfIndex();
for ($col = 'D'; $col != 'E'; ++$col) {
for ($row = 1; $row <= 100; ++$row) {
$activeSheet->getCell($col . $row)->setXfIndex($xfIndex);
}
}
DÜZENLEME
Alternatif olarak, Classes/PHPExcel/Worksheet.php
numaralı makalede duplicateStyle() yöntemine düzeltme uygulayın
hatları 1479, o anda okunmakta:
if ($this->_parent->cellXfExists($pCellStyle)) {
// there is already this cell Xf in our collection
$xfIndex = $pCellStyle->getIndex();
} else {
// we don't have such a cell Xf, need to add
$workbook->addCellXf($pCellStyle);
$xfIndex = $pCellStyle->getIndex();
}
değişimi için: Classes'daki applyFromArray() yönteminde Benzer
if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) {
// there is already such cell Xf in our collection
$xfIndex = $existingStyle->getIndex();
} else {
// we don't have such a cell Xf, need to add
$workbook->addCellXf($pCellStyle);
$xfIndex = $pCellStyle->getIndex();
}
/PHPExcel/Style.php
satır 425-432 Şu anda okuyun:
if ($workbook->cellXfExists($newStyle)) {
// there is already such cell Xf in our collection
$newXfIndexes[$oldXfIndex] = $existingStyle->getIndex();
} else {
// we don't have such a cell Xf, need to add
$workbook->addCellXf($newStyle);
$newXfIndexes[$oldXfIndex] = $newStyle->getIndex();
}
Şuna değiştirin:
if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) {
// there is already such cell Xf in our collection
$newXfIndexes[$oldXfIndex] = $existingStyle->getIndex();
} else {
// we don't have such a cell Xf, need to add
$workbook->addCellXf($newStyle);
$newXfIndexes[$oldXfIndex] = $newStyle->getIndex();
}
DÜZENLEME 2.
Fix şimdi github geliştirmek dalına itilmiştir. Kullanımdaki stil sayısına bağlı olarak hafif bir performans vuruşu verir ... Yarın gece daha hızlı bir versiyona girerim ve deneyeceğim.
Teşekkürler Mark - yamalar mükemmel çalıştı. Harika bir ürün için iç destek. –
getXfIndex() ve setXfIndex() yöntemlerini son derece yararlı buldum. Bu acımasızlık PHPExcel'in doktoru çok seyrek çünkü bu cevap olmadan bir Xf'in ne olduğunu asla tahmin edemezdim. – soger
@soger - Microsoft belgelerinden ne 'xf' ne olduğunu anlamaya gayet eğlenceli. –