You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2016/11/04 11:11:09 UTC
svn commit: r1768012 - in /poi/trunk/src:
java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
java/org/apache/poi/ss/usermodel/CellStyle.java
ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
Author: nick
Date: Fri Nov 4 11:11:09 2016
New Revision: 1768012
URL: http://svn.apache.org/viewvc?rev=1768012&view=rev
Log:
As requested on StackOverflow, expose on CellStyle QuotePrefix/123Prefix
Modified:
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=1768012&r1=1768011&r2=1768012&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java Fri Nov 4 11:11:09 2016
@@ -244,6 +244,24 @@ public final class HSSFCellStyle impleme
}
/**
+ * 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
* @see #ALIGN_GENERAL
Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java?rev=1768012&r1=1768011&r2=1768012&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java Fri Nov 4 11:11:09 2016
@@ -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
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java?rev=1768012&r1=1768011&r2=1768012&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java Fri Nov 4 11:11:09 2016
@@ -46,7 +46,6 @@ import org.openxmlformats.schemas.spread
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
@@ -656,6 +655,14 @@ public class XSSFCellStyle implements Ce
}
/**
+ * 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
*
* @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
@@ -1255,6 +1262,16 @@ public class XSSFCellStyle implements Ce
}
_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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org