@@ -3687,6 +3687,7 @@ private function readLabelSst()
3687
3687
$ column = self ::getInt2d ($ recordData , 2 );
3688
3688
$ columnString = PHPExcel_Cell::stringFromColumnIndex ($ column );
3689
3689
3690
+ $ emptyCell = true ;
3690
3691
// Read cell?
3691
3692
if (($ this ->getReadFilter () !== null ) && $ this ->getReadFilter ()->readCell ($ columnString , $ row + 1 , $ this ->phpSheet ->getTitle ())) {
3692
3693
// offset: 4; size: 2; index to XF record
@@ -3727,14 +3728,20 @@ private function readLabelSst()
3727
3728
}
3728
3729
}
3729
3730
}
3730
- $ cell = $ this ->phpSheet ->getCell ($ columnString . ($ row + 1 ));
3731
- $ cell ->setValueExplicit ($ richText , PHPExcel_Cell_DataType::TYPE_STRING );
3731
+ if ($ this ->readEmptyCells || trim ($ richText ->getPlainText ()) !== '' ) {
3732
+ $ cell = $ this ->phpSheet ->getCell ($ columnString . ($ row + 1 ));
3733
+ $ cell ->setValueExplicit ($ richText , PHPExcel_Cell_DataType::TYPE_STRING );
3734
+ $ emptyCell = false ;
3735
+ }
3732
3736
} else {
3733
- $ cell = $ this ->phpSheet ->getCell ($ columnString . ($ row + 1 ));
3734
- $ cell ->setValueExplicit ($ this ->sst [$ index ]['value ' ], PHPExcel_Cell_DataType::TYPE_STRING );
3737
+ if ($ this ->readEmptyCells || trim ($ this ->sst [$ index ]['value ' ]) !== '' ) {
3738
+ $ cell = $ this ->phpSheet ->getCell ($ columnString . ($ row + 1 ));
3739
+ $ cell ->setValueExplicit ($ this ->sst [$ index ]['value ' ], PHPExcel_Cell_DataType::TYPE_STRING );
3740
+ $ emptyCell = false ;
3741
+ }
3735
3742
}
3736
3743
3737
- if (!$ this ->readDataOnly ) {
3744
+ if (!$ this ->readDataOnly && ! $ emptyCell ) {
3738
3745
// add style information
3739
3746
$ cell ->setXfIndex ($ this ->mapCellXfIndex [$ xfIndex ]);
3740
3747
}
@@ -4108,7 +4115,7 @@ private function readMulBlank()
4108
4115
4109
4116
// offset: 4; size: 2 x nc; list of indexes to XF records
4110
4117
// add style information
4111
- if (!$ this ->readDataOnly ) {
4118
+ if (!$ this ->readDataOnly && $ this -> readEmptyCells ) {
4112
4119
for ($ i = 0 ; $ i < $ length / 2 - 3 ; ++$ i ) {
4113
4120
$ columnString = PHPExcel_Cell::stringFromColumnIndex($ fc + $ i );
4114
4121
@@ -4163,12 +4170,14 @@ private function readLabel()
4163
4170
$ string = $ this ->readByteStringLong(substr($ recordData, 6 ));
4164
4171
$ value = $ string['value'];
4165
4172
}
4166
- $ cell = $ this ->phpSheet->getCell($ columnString . ($ row + 1 ));
4167
- $ cell->setValueExplicit($ value, PHPExcel_Cell_DataType::TYPE_STRING );
4173
+ if ($ this ->readEmptyCells || trim ($ value ) !== '' ) {
4174
+ $ cell = $ this ->phpSheet->getCell($ columnString . ($ row + 1 ));
4175
+ $ cell->setValueExplicit($ value, PHPExcel_Cell_DataType::TYPE_STRING );
4168
4176
4169
- if (!$ this ->readDataOnly) {
4170
- // add cell style
4171
- $ cell->setXfIndex($ this ->mapCellXfIndex[$ xfIndex]);
4177
+ if (!$ this ->readDataOnly) {
4178
+ // add cell style
4179
+ $ cell->setXfIndex($ this ->mapCellXfIndex[$ xfIndex]);
4180
+ }
4172
4181
}
4173
4182
}
4174
4183
}
@@ -4198,11 +4207,10 @@ private function readBlank()
4198
4207
$ xfIndex = self::getInt2d($ recordData, 4 );
4199
4208
4200
4209
// add style information
4201
- if (!$ this ->readDataOnly) {
4210
+ if (!$ this ->readDataOnly && $ this -> readEmptyCells ) {
4202
4211
$ this ->phpSheet ->getCell ($ columnString . ($ row + 1 ))->setXfIndex ($ this ->mapCellXfIndex [$ xfIndex ]);
4203
4212
}
4204
4213
}
4205
-
4206
4214
}
4207
4215
4208
4216
0 commit comments