Skip to content

Commit ee78ced

Browse files
committed
#2489 CSV export now treats header rows as non-numeric, even if the column is numeric
1 parent 50a0f18 commit ee78ced

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Source/SPCSVExporter.m

+7-1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ - (void)exportOperation
232232
}
233233

234234
// Retrieve the next row from the supplied data, either directly from the array...
235+
BOOL forceNonNumericRow = NO;
235236
if ([self csvDataArray]) {
236237
csvRow = NSArrayObjectAtIndex([self csvDataArray], currentRowIndex);
237238
}
@@ -241,6 +242,7 @@ - (void)exportOperation
241242
if ([self csvOutputFieldNames]) {
242243
csvRow = [streamingResult fieldNames];
243244
[self setCsvOutputFieldNames:NO];
245+
forceNonNumericRow = YES;
244246
}
245247
else {
246248
csvRow = [streamingResult getRowAsArray];
@@ -298,8 +300,12 @@ - (void)exportOperation
298300
[csvString appendString:[self csvEnclosingCharacterString]];
299301
}
300302
else {
303+
// is this the header row?
304+
if (forceNonNumericRow) {
305+
csvCellIsNumeric = NO;
306+
}
301307
// If an array of bools supplying information as to whether the column is numeric has been supplied, use it.
302-
if ([tableColumnNumericStatus count] > 0) {
308+
else if ([tableColumnNumericStatus count] > 0) {
303309
csvCellIsNumeric = [NSArrayObjectAtIndex(tableColumnNumericStatus, i) boolValue];
304310
}
305311
// Otherwise, first test whether this cell contains data

0 commit comments

Comments
 (0)