Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Method to get the original value as a string #680

Closed
wants to merge 1 commit into from
Closed

Method to get the original value as a string #680

wants to merge 1 commit into from

Conversation

og3og
Copy link

@og3og og3og commented Sep 16, 2015

This will prevent leading zeros from being removed.

This will prevent leading zeros from being removed.
@MarkBaker
Copy link
Member

I'm not sure I see the point in this (and it won't work as you expect either).

If you've loaded a PHPExcel object from a spreadsheet file, it will retain any existing string values as strings (with any leading zeroes as appropriate).
If you're loading from a CSV file, or HTML, then you can use a value binder to retain any leading zero strings.... though I already implemented a change in version 1.8.1 to the default value binder to do this if a numeric string had leading zeroes anyway (Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric).

If you're setting values with leading zeroes yourself, then use setCellValueExplicit() which will set the datatype to string by default, and retain any leading zeroes.

The original value without any formatting is already maintained in the $value property, as a value of the appropriate datatype.... you don't need a new property to maintain that explicitly as a string datatype, especially when the original might have been a Boolean or a rich text object.

@MarkBaker MarkBaker closed this Sep 16, 2015
@og3og
Copy link
Author

og3og commented Sep 16, 2015

Got it! thanks a lot for pointing me in the right direction.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants