diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index 0fd7cf2ad..542ee2210 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -243,6 +243,24 @@ public final class HSSFCellStyle implements CellStyle { return _format.isLocked(); } + /** + * Turn on or off "Quote Prefix" or "123 Prefix" for the style, + * which is used to tell Excel that the thing which looks like + * a number or a formula shouldn't be treated as on. + */ + @Override + public void setQuotePrefixed(boolean quotePrefix) { + _format.set123Prefix(quotePrefix); + } + + /** + * Is "Quote Prefix" or "123 Prefix" enabled for the cell? + */ + @Override + public boolean getQuotePrefixed() { + return _format.get123Prefix(); + } + /** * set the type of horizontal alignment for the cell * @param align - the type of alignment diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java index 1eab8dec1..d16619c4d 100644 --- a/src/java/org/apache/poi/ss/usermodel/CellStyle.java +++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java @@ -397,6 +397,22 @@ public interface CellStyle { */ boolean getLocked(); + + /** + * Turn on or off "Quote Prefix" or "123 Prefix" for the style, + * which is used to tell Excel that the thing which looks like + * a number or a formula shouldn't be treated as on. + * Turning this on is somewhat (but not completely, see {@link IgnoredErrorType}) + * like prefixing the cell value with a ' in Excel + */ + void setQuotePrefixed(boolean quotePrefix); + + /** + * Is "Quote Prefix" or "123 Prefix" enabled for the cell? + * Having this on is somewhat (but not completely, see {@link IgnoredErrorType}) + * like prefixing the cell value with a ' in Excel + */ + boolean getQuotePrefixed(); /** * set the type of horizontal alignment for the cell diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index 9eec21ec6..6e66f9926 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -46,7 +46,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf; import org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle; import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPatternType; - /** * * High level representation of the the possible formatting information for the contents of the cells on a sheet in a @@ -655,6 +654,14 @@ public class XSSFCellStyle implements CellStyle { return _cellXf.getProtection().getLocked(); } + /** + * Is "Quote Prefix" or "123 Prefix" enabled for the cell? + */ + @Override + public boolean getQuotePrefixed() { + return _cellXf.getQuotePrefix(); + } + /** * Get the color to use for the right border * @@ -1255,6 +1262,16 @@ public class XSSFCellStyle implements CellStyle { } _cellXf.getProtection().setLocked(locked); } + + /** + * Turn on or off "Quote Prefix" or "123 Prefix" for the style, + * which is used to tell Excel that the thing which looks like + * a number or a formula shouldn't be treated as on. + */ + @Override + public void setQuotePrefixed(boolean quotePrefix) { + _cellXf.setQuotePrefix(quotePrefix); + } /** * Set the color to use for the right border