You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/05/22 20:56:49 UTC
svn commit: r1890120 [13/43] - in /poi/trunk/poi/src:
main/java/org/apache/poi/ main/java/org/apache/poi/ddf/
main/java/org/apache/poi/extractor/ main/java/org/apache/poi/hpsf/
main/java/org/apache/poi/hssf/ main/java/org/apache/poi/hssf/dev/
main/java...
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java Sat May 22 20:56:44 2021
@@ -1037,7 +1037,7 @@ public class HSSFCell extends CellBase {
sdf.setTimeZone(LocaleUtil.getUserTimeZone());
return sdf.format(getDateCellValue());
}
- return String.valueOf(getNumericCellValue());
+ return String.valueOf(getNumericCellValue());
case STRING:
return getStringCellValue();
default:
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChart.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChart.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChart.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChart.java Sat May 22 20:56:44 2021
@@ -142,9 +142,9 @@ public final class HSSFChart {
records.add( createValuesLinkedDataRecord() );
records.add( createCategoriesLinkedDataRecord() );
records.add( createDataFormatRecord() );
- // records.add(createBeginRecord());
+ // records.add(createBeginRecord());
// unknown
- // records.add(createEndRecord());
+ // records.add(createEndRecord());
records.add( createSeriesToChartGroupRecord() );
records.add( createEndRecord() );
records.add( createSheetPropsRecord() );
@@ -590,7 +590,7 @@ public final class HSSFChart {
r.setLogarithmicScale( false );
r.setValuesInReverse( false );
r.setCrossCategoryAxisAtMaximum( false );
- r.setReserved( true ); // what's this do??
+ r.setReserved( true ); // what's this do??
return r;
}
@@ -847,9 +847,9 @@ public final class HSSFChart {
private AreaFormatRecord createAreaFormatRecord1()
{
AreaFormatRecord r = new AreaFormatRecord();
- r.setForegroundColor( 16777215 ); // RGB Color
- r.setBackgroundColor( 0 ); // RGB Color
- r.setPattern( (short) 1 ); // TODO: Add Pattern constants to record
+ r.setForegroundColor( 16777215 ); // RGB Color
+ r.setBackgroundColor( 0 ); // RGB Color
+ r.setPattern( (short) 1 ); // TODO: Add Pattern constants to record
r.setAutomatic( true );
r.setInvert( false );
r.setForecolorIndex( (short) 78 );
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java Sat May 22 20:56:44 2021
@@ -38,97 +38,97 @@ import org.apache.poi.ss.usermodel.DataF
* @see <a href="https://support.microsoft.com/en-us/office/review-guidelines-for-customizing-a-number-format-c0a1d1fa-d3f4-4018-96b7-9c9354dd99f5">Review guidelines for customizing a number format</a>
*/
public final class HSSFDataFormat implements DataFormat {
- private static final String[] _builtinFormats = BuiltinFormats.getAll();
+ private static final String[] _builtinFormats = BuiltinFormats.getAll();
- private final Vector<String> _formats = new Vector<>();
- private final InternalWorkbook _workbook;
- private boolean _movedBuiltins; // Flag to see if need to
- // check the built in list
- // or if the regular list
- // has all entries.
-
- /**
- * Constructs a new data formatter. It takes a workbook to have
- * access to the workbooks format records.
- * @param workbook the workbook the formats are tied to.
- */
- HSSFDataFormat(InternalWorkbook workbook) {
- _workbook = workbook;
-
- Iterator<FormatRecord> i = workbook.getFormats().iterator();
- while (i.hasNext()) {
- FormatRecord r = i.next();
- ensureFormatsSize(r.getIndexCode());
- _formats.set(r.getIndexCode(), r.getFormatString());
- }
- }
-
- public static List<String> getBuiltinFormats() {
- return Arrays.asList(_builtinFormats);
- }
-
- /**
- * get the format index that matches the given format string<p>
- * Automatically converts "text" to excel's format string to represent text.
- * @param format string matching a built in format
- * @return index of format or -1 if undefined.
- */
- public static short getBuiltinFormat(String format) {
- return (short) BuiltinFormats.getBuiltinFormat(format);
- }
-
- /**
- * Get the format index that matches the given format
- * string, creating a new format entry if required.
- * Aliases text to the proper format as required.
- * @param pFormat string matching a built in format
- * @return index of format.
- */
- public short getFormat(String pFormat) {
- // Normalise the format string
- String format;
- if (pFormat.equalsIgnoreCase("TEXT")) {
- format = "@";
- } else {
- format = pFormat;
- }
-
- // Merge in the built in formats if we haven't already
- if (!_movedBuiltins) {
- for (int i=0; i<_builtinFormats.length; i++) {
- ensureFormatsSize(i);
- if (_formats.get(i) == null) {
- _formats.set(i, _builtinFormats[i]);
- } else {
- // The workbook overrides this default format
- }
- }
- _movedBuiltins = true;
- }
-
- // See if we can find it
- for(int i=0; i<_formats.size(); i++) {
- if(format.equals(_formats.get(i))) {
- return (short)i;
- }
- }
-
- // We can't find it, so add it as a new one
- short index = _workbook.getFormat(format, true);
- ensureFormatsSize(index);
- _formats.set(index, format);
- return index;
- }
-
- /**
- * get the format string that matches the given format index
- * @param index of a format
- * @return string represented at index of format or null if there is not a format at that index
- */
- public String getFormat(short index) {
- if (_movedBuiltins) {
- return _formats.get(index);
- }
+ private final Vector<String> _formats = new Vector<>();
+ private final InternalWorkbook _workbook;
+ private boolean _movedBuiltins; // Flag to see if need to
+ // check the built in list
+ // or if the regular list
+ // has all entries.
+
+ /**
+ * Constructs a new data formatter. It takes a workbook to have
+ * access to the workbooks format records.
+ * @param workbook the workbook the formats are tied to.
+ */
+ HSSFDataFormat(InternalWorkbook workbook) {
+ _workbook = workbook;
+
+ Iterator<FormatRecord> i = workbook.getFormats().iterator();
+ while (i.hasNext()) {
+ FormatRecord r = i.next();
+ ensureFormatsSize(r.getIndexCode());
+ _formats.set(r.getIndexCode(), r.getFormatString());
+ }
+ }
+
+ public static List<String> getBuiltinFormats() {
+ return Arrays.asList(_builtinFormats);
+ }
+
+ /**
+ * get the format index that matches the given format string<p>
+ * Automatically converts "text" to excel's format string to represent text.
+ * @param format string matching a built in format
+ * @return index of format or -1 if undefined.
+ */
+ public static short getBuiltinFormat(String format) {
+ return (short) BuiltinFormats.getBuiltinFormat(format);
+ }
+
+ /**
+ * Get the format index that matches the given format
+ * string, creating a new format entry if required.
+ * Aliases text to the proper format as required.
+ * @param pFormat string matching a built in format
+ * @return index of format.
+ */
+ public short getFormat(String pFormat) {
+ // Normalise the format string
+ String format;
+ if (pFormat.equalsIgnoreCase("TEXT")) {
+ format = "@";
+ } else {
+ format = pFormat;
+ }
+
+ // Merge in the built in formats if we haven't already
+ if (!_movedBuiltins) {
+ for (int i=0; i<_builtinFormats.length; i++) {
+ ensureFormatsSize(i);
+ if (_formats.get(i) == null) {
+ _formats.set(i, _builtinFormats[i]);
+ } else {
+ // The workbook overrides this default format
+ }
+ }
+ _movedBuiltins = true;
+ }
+
+ // See if we can find it
+ for(int i=0; i<_formats.size(); i++) {
+ if(format.equals(_formats.get(i))) {
+ return (short)i;
+ }
+ }
+
+ // We can't find it, so add it as a new one
+ short index = _workbook.getFormat(format, true);
+ ensureFormatsSize(index);
+ _formats.set(index, format);
+ return index;
+ }
+
+ /**
+ * get the format string that matches the given format index
+ * @param index of a format
+ * @return string represented at index of format or null if there is not a format at that index
+ */
+ public String getFormat(short index) {
+ if (_movedBuiltins) {
+ return _formats.get(index);
+ }
if(index == -1) {
// YK: formatIndex can be -1, for example, for cell in column Y in test-data/spreadsheet/45322.xls
@@ -136,44 +136,44 @@ public final class HSSFDataFormat implem
return null;
}
- String fmt = _formats.size() > index ? _formats.get(index) : null;
- if (_builtinFormats.length > index && _builtinFormats[index] != null) {
- // It's in the built in range
- if (fmt != null) {
- // It's been overriden, use that value
- return fmt;
- } else {
- // Standard built in format
- return _builtinFormats[index];
- }
- }
- return fmt;
- }
-
- /**
- * get the format string that matches the given format index
- * @param index of a built in format
- * @return string represented at index of format or null if there is not a builtin format at that index
- */
- public static String getBuiltinFormat(short index) {
- return BuiltinFormats.getBuiltinFormat(index);
- }
-
- /**
- * get the number of built-in and reserved builtinFormats
- * @return number of built-in and reserved builtinFormats
- */
- public static int getNumberOfBuiltinBuiltinFormats() {
- return _builtinFormats.length;
- }
-
- /**
- * Ensures that the formats list can hold entries
- * up to and including the entry with this index
- */
- private void ensureFormatsSize(int index) {
- if(_formats.size() <= index) {
- _formats.setSize(index+1);
- }
- }
+ String fmt = _formats.size() > index ? _formats.get(index) : null;
+ if (_builtinFormats.length > index && _builtinFormats[index] != null) {
+ // It's in the built in range
+ if (fmt != null) {
+ // It's been overriden, use that value
+ return fmt;
+ } else {
+ // Standard built in format
+ return _builtinFormats[index];
+ }
+ }
+ return fmt;
+ }
+
+ /**
+ * get the format string that matches the given format index
+ * @param index of a built in format
+ * @return string represented at index of format or null if there is not a builtin format at that index
+ */
+ public static String getBuiltinFormat(short index) {
+ return BuiltinFormats.getBuiltinFormat(index);
+ }
+
+ /**
+ * get the number of built-in and reserved builtinFormats
+ * @return number of built-in and reserved builtinFormats
+ */
+ public static int getNumberOfBuiltinBuiltinFormats() {
+ return _builtinFormats.length;
+ }
+
+ /**
+ * Ensures that the formats list can hold entries
+ * up to and including the entry with this index
+ */
+ private void ensureFormatsSize(int index) {
+ if(_formats.size() <= index) {
+ _formats.setSize(index+1);
+ }
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidation.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidation.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidation.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidation.java Sat May 22 20:56:44 2021
@@ -28,195 +28,195 @@ import org.apache.poi.ss.util.CellRangeA
* Utility class for creating data validation cells
*/
public final class HSSFDataValidation implements DataValidation {
- private String _prompt_title;
- private String _prompt_text;
- private String _error_title;
- private String _error_text;
-
- private int _errorStyle = ErrorStyle.STOP;
- private boolean _emptyCellAllowed = true;
- private boolean _suppress_dropdown_arrow;
- private boolean _showPromptBox = true;
- private boolean _showErrorBox = true;
- private CellRangeAddressList _regions;
- private DVConstraint _constraint;
-
- /**
- * Constructor which initializes the cell range on which this object will be
- * applied
- *
- * @param regions A list of regions where the constraint is validated.
- * @param constraint The constraints to apply for this validation.
- */
- public HSSFDataValidation(CellRangeAddressList regions, DataValidationConstraint constraint) {
- _regions = regions;
-
- //FIXME: This cast can be avoided.
- _constraint = (DVConstraint)constraint;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getConstraint()
- */
- public DataValidationConstraint getValidationConstraint() {
- return _constraint;
- }
-
- public DVConstraint getConstraint() {
- return _constraint;
- }
-
- public CellRangeAddressList getRegions() {
- return _regions;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#setErrorStyle(int)
- */
- public void setErrorStyle(int error_style) {
- _errorStyle = error_style;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getErrorStyle()
- */
- public int getErrorStyle() {
- return _errorStyle;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#setEmptyCellAllowed(boolean)
- */
- public void setEmptyCellAllowed(boolean allowed) {
- _emptyCellAllowed = allowed;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getEmptyCellAllowed()
- */
- public boolean getEmptyCellAllowed() {
- return _emptyCellAllowed;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#setSuppressDropDownArrow(boolean)
- */
- public void setSuppressDropDownArrow(boolean suppress) {
- _suppress_dropdown_arrow = suppress;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getSuppressDropDownArrow()
- */
- public boolean getSuppressDropDownArrow() {
- //noinspection SimplifiableIfStatement
- if (_constraint.getValidationType()==ValidationType.LIST) {
- return _suppress_dropdown_arrow;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#setShowPromptBox(boolean)
- */
- public void setShowPromptBox(boolean show) {
- _showPromptBox = show;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getShowPromptBox()
- */
- public boolean getShowPromptBox() {
- return _showPromptBox;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#setShowErrorBox(boolean)
- */
- public void setShowErrorBox(boolean show) {
- _showErrorBox = show;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getShowErrorBox()
- */
- public boolean getShowErrorBox() {
- return _showErrorBox;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#createPromptBox(java.lang.String, java.lang.String)
- */
- public void createPromptBox(String title, String text) {
- // check length-limits
- if(title != null && title.length() > 32) {
- throw new IllegalStateException("Prompt-title cannot be longer than 32 characters, but had: " + title);
- }
- if(text != null && text.length() > 255) {
- throw new IllegalStateException("Prompt-text cannot be longer than 255 characters, but had: " + text);
- }
- _prompt_title = title;
- _prompt_text = text;
- this.setShowPromptBox(true);
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getPromptBoxTitle()
- */
- public String getPromptBoxTitle() {
- return _prompt_title;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getPromptBoxText()
- */
- public String getPromptBoxText() {
- return _prompt_text;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#createErrorBox(java.lang.String, java.lang.String)
- */
- public void createErrorBox(String title, String text) {
- if(title != null && title.length() > 32) {
- throw new IllegalStateException("Error-title cannot be longer than 32 characters, but had: " + title);
- }
- if(text != null && text.length() > 255) {
- throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + text);
- }
- _error_title = title;
- _error_text = text;
- this.setShowErrorBox(true);
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getErrorBoxTitle()
- */
- public String getErrorBoxTitle() {
- return _error_title;
- }
-
- /* (non-Javadoc)
- * @see org.apache.poi.hssf.usermodel.DataValidation#getErrorBoxText()
- */
- public String getErrorBoxText() {
- return _error_text;
- }
-
- public DVRecord createDVRecord(HSSFSheet sheet) {
-
- FormulaPair fp = _constraint.createFormulas(sheet);
-
- return new DVRecord(_constraint.getValidationType(),
- _constraint.getOperator(),
- _errorStyle, _emptyCellAllowed, getSuppressDropDownArrow(),
- _constraint.getValidationType()==ValidationType.LIST && _constraint.getExplicitListValues()!=null,
- _showPromptBox, _prompt_title, _prompt_text,
- _showErrorBox, _error_title, _error_text,
- fp.getFormula1(), fp.getFormula2(),
- _regions);
- }
+ private String _prompt_title;
+ private String _prompt_text;
+ private String _error_title;
+ private String _error_text;
+
+ private int _errorStyle = ErrorStyle.STOP;
+ private boolean _emptyCellAllowed = true;
+ private boolean _suppress_dropdown_arrow;
+ private boolean _showPromptBox = true;
+ private boolean _showErrorBox = true;
+ private CellRangeAddressList _regions;
+ private DVConstraint _constraint;
+
+ /**
+ * Constructor which initializes the cell range on which this object will be
+ * applied
+ *
+ * @param regions A list of regions where the constraint is validated.
+ * @param constraint The constraints to apply for this validation.
+ */
+ public HSSFDataValidation(CellRangeAddressList regions, DataValidationConstraint constraint) {
+ _regions = regions;
+
+ //FIXME: This cast can be avoided.
+ _constraint = (DVConstraint)constraint;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getConstraint()
+ */
+ public DataValidationConstraint getValidationConstraint() {
+ return _constraint;
+ }
+
+ public DVConstraint getConstraint() {
+ return _constraint;
+ }
+
+ public CellRangeAddressList getRegions() {
+ return _regions;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#setErrorStyle(int)
+ */
+ public void setErrorStyle(int error_style) {
+ _errorStyle = error_style;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getErrorStyle()
+ */
+ public int getErrorStyle() {
+ return _errorStyle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#setEmptyCellAllowed(boolean)
+ */
+ public void setEmptyCellAllowed(boolean allowed) {
+ _emptyCellAllowed = allowed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getEmptyCellAllowed()
+ */
+ public boolean getEmptyCellAllowed() {
+ return _emptyCellAllowed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#setSuppressDropDownArrow(boolean)
+ */
+ public void setSuppressDropDownArrow(boolean suppress) {
+ _suppress_dropdown_arrow = suppress;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getSuppressDropDownArrow()
+ */
+ public boolean getSuppressDropDownArrow() {
+ //noinspection SimplifiableIfStatement
+ if (_constraint.getValidationType()==ValidationType.LIST) {
+ return _suppress_dropdown_arrow;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#setShowPromptBox(boolean)
+ */
+ public void setShowPromptBox(boolean show) {
+ _showPromptBox = show;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getShowPromptBox()
+ */
+ public boolean getShowPromptBox() {
+ return _showPromptBox;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#setShowErrorBox(boolean)
+ */
+ public void setShowErrorBox(boolean show) {
+ _showErrorBox = show;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getShowErrorBox()
+ */
+ public boolean getShowErrorBox() {
+ return _showErrorBox;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#createPromptBox(java.lang.String, java.lang.String)
+ */
+ public void createPromptBox(String title, String text) {
+ // check length-limits
+ if(title != null && title.length() > 32) {
+ throw new IllegalStateException("Prompt-title cannot be longer than 32 characters, but had: " + title);
+ }
+ if(text != null && text.length() > 255) {
+ throw new IllegalStateException("Prompt-text cannot be longer than 255 characters, but had: " + text);
+ }
+ _prompt_title = title;
+ _prompt_text = text;
+ this.setShowPromptBox(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getPromptBoxTitle()
+ */
+ public String getPromptBoxTitle() {
+ return _prompt_title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getPromptBoxText()
+ */
+ public String getPromptBoxText() {
+ return _prompt_text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#createErrorBox(java.lang.String, java.lang.String)
+ */
+ public void createErrorBox(String title, String text) {
+ if(title != null && title.length() > 32) {
+ throw new IllegalStateException("Error-title cannot be longer than 32 characters, but had: " + title);
+ }
+ if(text != null && text.length() > 255) {
+ throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + text);
+ }
+ _error_title = title;
+ _error_text = text;
+ this.setShowErrorBox(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getErrorBoxTitle()
+ */
+ public String getErrorBoxTitle() {
+ return _error_title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.poi.hssf.usermodel.DataValidation#getErrorBoxText()
+ */
+ public String getErrorBoxText() {
+ return _error_text;
+ }
+
+ public DVRecord createDVRecord(HSSFSheet sheet) {
+
+ FormulaPair fp = _constraint.createFormulas(sheet);
+
+ return new DVRecord(_constraint.getValidationType(),
+ _constraint.getOperator(),
+ _errorStyle, _emptyCellAllowed, getSuppressDropDownArrow(),
+ _constraint.getValidationType()==ValidationType.LIST && _constraint.getExplicitListValues()!=null,
+ _showPromptBox, _prompt_title, _prompt_text,
+ _showErrorBox, _error_title, _error_text,
+ fp.getFormula1(), fp.getFormula2(),
+ _regions);
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidationHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidationHelper.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidationHelper.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataValidationHelper.java Sat May 22 20:56:44 2021
@@ -27,106 +27,106 @@ import org.apache.poi.ss.util.CellRangeA
* Helper for working with Data Validation
*/
public class HSSFDataValidationHelper implements DataValidationHelper {
- // Findbugs: URF_UNREAD_FIELD . Do not delete without understanding how this class works.
- //private HSSFSheet sheet;
-
- public HSSFDataValidationHelper(HSSFSheet sheet) {
- super();
- // Findbugs: URF_UNREAD_FIELD . Do not delete without understanding how this class works.
- //this.sheet = sheet;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createDateConstraint
- * (int, java.lang.String, java.lang.String, java.lang.String)
- */
- public DataValidationConstraint createDateConstraint(int operatorType, String formula1, String formula2, String dateFormat) {
- return DVConstraint.createDateConstraint(operatorType, formula1, formula2, dateFormat);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createExplicitListConstraint
- * (java.lang.String[])
- */
- public DataValidationConstraint createExplicitListConstraint(String[] listOfValues) {
- return DVConstraint.createExplicitListConstraint(listOfValues);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createFormulaListConstraint
- * (java.lang.String)
- */
- public DataValidationConstraint createFormulaListConstraint(String listFormula) {
- return DVConstraint.createFormulaListConstraint(listFormula);
- }
-
-
-
- public DataValidationConstraint createNumericConstraint(int validationType,int operatorType, String formula1, String formula2) {
- return DVConstraint.createNumericConstraint(validationType, operatorType, formula1, formula2);
- }
-
- public DataValidationConstraint createIntegerConstraint(int operatorType, String formula1, String formula2) {
- return DVConstraint.createNumericConstraint(ValidationType.INTEGER, operatorType, formula1, formula2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createNumericConstraint
- * (int, java.lang.String, java.lang.String)
- */
- public DataValidationConstraint createDecimalConstraint(int operatorType, String formula1, String formula2) {
- return DVConstraint.createNumericConstraint(ValidationType.DECIMAL, operatorType, formula1, formula2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createTextLengthConstraint
- * (int, java.lang.String, java.lang.String)
- */
- public DataValidationConstraint createTextLengthConstraint(int operatorType, String formula1, String formula2) {
- return DVConstraint.createNumericConstraint(ValidationType.TEXT_LENGTH, operatorType, formula1, formula2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createTimeConstraint
- * (int, java.lang.String, java.lang.String, java.lang.String)
- */
- public DataValidationConstraint createTimeConstraint(int operatorType, String formula1, String formula2) {
- return DVConstraint.createTimeConstraint(operatorType, formula1, formula2);
- }
-
-
-
- public DataValidationConstraint createCustomConstraint(String formula) {
- return DVConstraint.createCustomFormulaConstraint(formula);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.poi.ss.usermodel.DataValidationHelper#createValidation(org
- * .apache.poi.ss.usermodel.DataValidationConstraint,
- * org.apache.poi.ss.util.CellRangeAddressList)
- */
- public DataValidation createValidation(DataValidationConstraint constraint, CellRangeAddressList cellRangeAddressList) {
- return new HSSFDataValidation(cellRangeAddressList, constraint);
- }
+ // Findbugs: URF_UNREAD_FIELD . Do not delete without understanding how this class works.
+ //private HSSFSheet sheet;
+
+ public HSSFDataValidationHelper(HSSFSheet sheet) {
+ super();
+ // Findbugs: URF_UNREAD_FIELD . Do not delete without understanding how this class works.
+ //this.sheet = sheet;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createDateConstraint
+ * (int, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public DataValidationConstraint createDateConstraint(int operatorType, String formula1, String formula2, String dateFormat) {
+ return DVConstraint.createDateConstraint(operatorType, formula1, formula2, dateFormat);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createExplicitListConstraint
+ * (java.lang.String[])
+ */
+ public DataValidationConstraint createExplicitListConstraint(String[] listOfValues) {
+ return DVConstraint.createExplicitListConstraint(listOfValues);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createFormulaListConstraint
+ * (java.lang.String)
+ */
+ public DataValidationConstraint createFormulaListConstraint(String listFormula) {
+ return DVConstraint.createFormulaListConstraint(listFormula);
+ }
+
+
+
+ public DataValidationConstraint createNumericConstraint(int validationType,int operatorType, String formula1, String formula2) {
+ return DVConstraint.createNumericConstraint(validationType, operatorType, formula1, formula2);
+ }
+
+ public DataValidationConstraint createIntegerConstraint(int operatorType, String formula1, String formula2) {
+ return DVConstraint.createNumericConstraint(ValidationType.INTEGER, operatorType, formula1, formula2);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createNumericConstraint
+ * (int, java.lang.String, java.lang.String)
+ */
+ public DataValidationConstraint createDecimalConstraint(int operatorType, String formula1, String formula2) {
+ return DVConstraint.createNumericConstraint(ValidationType.DECIMAL, operatorType, formula1, formula2);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createTextLengthConstraint
+ * (int, java.lang.String, java.lang.String)
+ */
+ public DataValidationConstraint createTextLengthConstraint(int operatorType, String formula1, String formula2) {
+ return DVConstraint.createNumericConstraint(ValidationType.TEXT_LENGTH, operatorType, formula1, formula2);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createTimeConstraint
+ * (int, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public DataValidationConstraint createTimeConstraint(int operatorType, String formula1, String formula2) {
+ return DVConstraint.createTimeConstraint(operatorType, formula1, formula2);
+ }
+
+
+
+ public DataValidationConstraint createCustomConstraint(String formula) {
+ return DVConstraint.createCustomFormulaConstraint(formula);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.poi.ss.usermodel.DataValidationHelper#createValidation(org
+ * .apache.poi.ss.usermodel.DataValidationConstraint,
+ * org.apache.poi.ss.util.CellRangeAddressList)
+ */
+ public DataValidation createValidation(DataValidationConstraint constraint, CellRangeAddressList cellRangeAddressList) {
+ return new HSSFDataValidation(cellRangeAddressList, constraint);
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java Sat May 22 20:56:44 2021
@@ -34,7 +34,7 @@ import org.apache.poi.ss.usermodel.DateU
*/
@Deprecated
public final class HSSFDateUtil extends DateUtil {
- protected static int absoluteDay(Calendar cal, boolean use1904windowing) {
- return DateUtil.absoluteDay(cal, use1904windowing);
- }
+ protected static int absoluteDay(Calendar cal, boolean use1904windowing) {
+ return DateUtil.absoluteDay(cal, use1904windowing);
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java Sat May 22 20:56:44 2021
@@ -27,76 +27,76 @@ import org.apache.poi.ss.util.CellRangeA
*/
final class HSSFEvaluationCell implements EvaluationCell {
- private final EvaluationSheet _evalSheet;
- private final HSSFCell _cell;
+ private final EvaluationSheet _evalSheet;
+ private final HSSFCell _cell;
- public HSSFEvaluationCell(HSSFCell cell, EvaluationSheet evalSheet) {
- _cell = cell;
- _evalSheet = evalSheet;
- }
- public HSSFEvaluationCell(HSSFCell cell) {
- this(cell, new HSSFEvaluationSheet(cell.getSheet()));
- }
- @Override
- public Object getIdentityKey() {
- // save memory by just using the cell itself as the identity key
- // Note - this assumes HSSFCell has not overridden hashCode and equals
- return _cell;
- }
+ public HSSFEvaluationCell(HSSFCell cell, EvaluationSheet evalSheet) {
+ _cell = cell;
+ _evalSheet = evalSheet;
+ }
+ public HSSFEvaluationCell(HSSFCell cell) {
+ this(cell, new HSSFEvaluationSheet(cell.getSheet()));
+ }
+ @Override
+ public Object getIdentityKey() {
+ // save memory by just using the cell itself as the identity key
+ // Note - this assumes HSSFCell has not overridden hashCode and equals
+ return _cell;
+ }
- public HSSFCell getHSSFCell() {
- return _cell;
- }
- @Override
- public boolean getBooleanCellValue() {
- return _cell.getBooleanCellValue();
- }
- /**
- * @return cell type
- */
- @Override
- public CellType getCellType() {
- return _cell.getCellType();
- }
- @Override
- public int getColumnIndex() {
- return _cell.getColumnIndex();
- }
- @Override
- public int getErrorCellValue() {
- return _cell.getErrorCellValue();
- }
- @Override
- public double getNumericCellValue() {
- return _cell.getNumericCellValue();
- }
- @Override
- public int getRowIndex() {
- return _cell.getRowIndex();
- }
- @Override
- public EvaluationSheet getSheet() {
- return _evalSheet;
- }
- @Override
- public String getStringCellValue() {
- return _cell.getRichStringCellValue().getString();
- }
-
- @Override
- public CellRangeAddress getArrayFormulaRange() {
- return _cell.getArrayFormulaRange();
- }
-
- @Override
- public boolean isPartOfArrayFormulaGroup() {
- return _cell.isPartOfArrayFormulaGroup();
- }
-
- /**
- * @since POI 4.0
- * @return cell type of cached formula result
- */
- @Override
- public CellType getCachedFormulaResultType() { return _cell.getCachedFormulaResultType(); }
+ public HSSFCell getHSSFCell() {
+ return _cell;
+ }
+ @Override
+ public boolean getBooleanCellValue() {
+ return _cell.getBooleanCellValue();
+ }
+ /**
+ * @return cell type
+ */
+ @Override
+ public CellType getCellType() {
+ return _cell.getCellType();
+ }
+ @Override
+ public int getColumnIndex() {
+ return _cell.getColumnIndex();
+ }
+ @Override
+ public int getErrorCellValue() {
+ return _cell.getErrorCellValue();
+ }
+ @Override
+ public double getNumericCellValue() {
+ return _cell.getNumericCellValue();
+ }
+ @Override
+ public int getRowIndex() {
+ return _cell.getRowIndex();
+ }
+ @Override
+ public EvaluationSheet getSheet() {
+ return _evalSheet;
+ }
+ @Override
+ public String getStringCellValue() {
+ return _cell.getRichStringCellValue().getString();
+ }
+
+ @Override
+ public CellRangeAddress getArrayFormulaRange() {
+ return _cell.getArrayFormulaRange();
+ }
+
+ @Override
+ public boolean isPartOfArrayFormulaGroup() {
+ return _cell.isPartOfArrayFormulaGroup();
+ }
+
+ /**
+ * @since POI 4.0
+ * @return cell type of cached formula result
+ */
+ @Override
+ public CellType getCachedFormulaResultType() { return _cell.getCachedFormulaResultType(); }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java Sat May 22 20:56:44 2021
@@ -358,24 +358,24 @@ public final class HSSFFont implements F
"}";
}
- public int hashCode() {
+ public int hashCode() {
return Objects.hash(font,index);
- }
+ }
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (obj instanceof HSSFFont) {
- final HSSFFont other = (HSSFFont) obj;
- if (font == null) {
- if (other.font != null) {
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (obj instanceof HSSFFont) {
+ final HSSFFont other = (HSSFFont) obj;
+ if (font == null) {
+ if (other.font != null) {
return false;
}
- } else if (!font.equals(other.font)) {
+ } else if (!font.equals(other.font)) {
return false;
}
return index == other.index;
}
- return false;
- }
+ return false;
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFooter.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFooter.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFooter.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFooter.java Sat May 22 20:56:44 2021
@@ -32,28 +32,28 @@ import org.apache.poi.ss.usermodel.Foote
* fonts by using similar methods.
*/
public final class HSSFFooter extends HeaderFooter implements Footer {
- private final PageSettingsBlock _psb;
+ private final PageSettingsBlock _psb;
- protected HSSFFooter(PageSettingsBlock psb) {
- _psb = psb;
- }
+ protected HSSFFooter(PageSettingsBlock psb) {
+ _psb = psb;
+ }
- protected String getRawText() {
- FooterRecord hf = _psb.getFooter();
- if (hf == null) {
- return "";
- }
- return hf.getText();
- }
+ protected String getRawText() {
+ FooterRecord hf = _psb.getFooter();
+ if (hf == null) {
+ return "";
+ }
+ return hf.getText();
+ }
- @Override
- protected void setHeaderFooterText(String text) {
- FooterRecord hfr = _psb.getFooter();
- if (hfr == null) {
- hfr = new FooterRecord(text);
- _psb.setFooter(hfr);
- } else {
- hfr.setText(text);
- }
- }
+ @Override
+ protected void setHeaderFooterText(String text) {
+ FooterRecord hfr = _psb.getFooter();
+ if (hfr == null) {
+ hfr = new FooterRecord(text);
+ _psb.setFooter(hfr);
+ } else {
+ hfr.setText(text);
+ }
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHeader.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHeader.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHeader.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHeader.java Sat May 22 20:56:44 2021
@@ -33,28 +33,28 @@ import org.apache.poi.ss.usermodel.Heade
*/
public final class HSSFHeader extends HeaderFooter implements Header {
- private final PageSettingsBlock _psb;
+ private final PageSettingsBlock _psb;
- protected HSSFHeader(PageSettingsBlock psb) {
- _psb = psb;
- }
+ protected HSSFHeader(PageSettingsBlock psb) {
+ _psb = psb;
+ }
- protected String getRawText() {
- HeaderRecord hf = _psb.getHeader();
- if (hf == null) {
- return "";
- }
- return hf.getText();
- }
+ protected String getRawText() {
+ HeaderRecord hf = _psb.getHeader();
+ if (hf == null) {
+ return "";
+ }
+ return hf.getText();
+ }
- @Override
- protected void setHeaderFooterText(String text) {
- HeaderRecord hfr = _psb.getHeader();
- if (hfr == null) {
- hfr = new HeaderRecord(text);
- _psb.setHeader(hfr);
- } else {
- hfr.setText(text);
- }
- }
+ @Override
+ protected void setHeaderFooterText(String text) {
+ HeaderRecord hfr = _psb.getHeader();
+ if (hfr == null) {
+ hfr = new HeaderRecord(text);
+ _psb.setHeader(hfr);
+ } else {
+ hfr.setText(text);
+ }
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java Sat May 22 20:56:44 2021
@@ -39,131 +39,131 @@ import org.apache.poi.ss.usermodel.Row;
* is where the use of this class comes in.
*/
public class HSSFOptimiser {
- /**
- * Goes through the Workbook, optimising the fonts by
- * removing duplicate ones.
- * For now, only works on fonts used in {@link HSSFCellStyle}
- * and {@link HSSFRichTextString}. Any other font uses
- * (eg charts, pictures) may well end up broken!
- * This can be a slow operation, especially if you have
- * lots of cells, cell styles or rich text strings
- * @param workbook The workbook in which to optimise the fonts
- */
- public static void optimiseFonts(HSSFWorkbook workbook) {
- // Where each font has ended up, and if we need to
- // delete the record for it. Start off with no change
- short[] newPos =
- new short[workbook.getWorkbook().getNumberOfFontRecords()+1];
- boolean[] zapRecords = new boolean[newPos.length];
- for(int i=0; i<newPos.length; i++) {
- newPos[i] = (short)i;
- zapRecords[i] = false;
- }
-
- // Get each font record, so we can do deletes
- // without getting confused
- FontRecord[] frecs = new FontRecord[newPos.length];
- for(int i=0; i<newPos.length; i++) {
- // There is no 4!
- if(i == 4) continue;
-
- frecs[i] = workbook.getWorkbook().getFontRecordAt(i);
- }
-
- // Loop over each font, seeing if it is the same
- // as an earlier one. If it is, point users of the
- // later duplicate copy to the earlier one, and
- // mark the later one as needing deleting
- // Note - don't change built in fonts (those before 5)
- for(int i=5; i<newPos.length; i++) {
- // Check this one for being a duplicate
- // of an earlier one
- int earlierDuplicate = -1;
- for(int j=0; j<i && earlierDuplicate == -1; j++) {
- if(j == 4) continue;
-
- FontRecord frCheck = workbook.getWorkbook().getFontRecordAt(j);
- if(frCheck.sameProperties(frecs[i])) {
- earlierDuplicate = j;
- }
- }
-
- // If we got a duplicate, mark it as such
- if(earlierDuplicate != -1) {
- newPos[i] = (short)earlierDuplicate;
- zapRecords[i] = true;
- }
- }
-
- // Update the new positions based on
- // deletes that have occurred between
- // the start and them
- // Only need to worry about user fonts
- for(int i=5; i<newPos.length; i++) {
- // Find the number deleted to that
- // point, and adjust
- short preDeletePos = newPos[i];
- short newPosition = preDeletePos;
- for(int j=0; j<preDeletePos; j++) {
- if(zapRecords[j]) newPosition--;
- }
-
- // Update the new position
- newPos[i] = newPosition;
- }
-
- // Zap the un-needed user font records
- for(int i=5; i<newPos.length; i++) {
- if(zapRecords[i]) {
- workbook.getWorkbook().removeFontRecord(
- frecs[i]
- );
- }
- }
-
- // Tell HSSFWorkbook that it needs to
- // re-start its HSSFFontCache
- workbook.resetFontCache();
-
- // Update the cell styles to point at the
- // new locations of the fonts
- for(int i=0; i<workbook.getWorkbook().getNumExFormats(); i++) {
- ExtendedFormatRecord xfr = workbook.getWorkbook().getExFormatAt(i);
- xfr.setFontIndex(
- newPos[ xfr.getFontIndex() ]
- );
- }
-
- // Update the rich text strings to point at
- // the new locations of the fonts
- // Remember that one underlying unicode string
- // may be shared by multiple RichTextStrings!
- HashSet<UnicodeString> doneUnicodeStrings = new HashSet<>();
- for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
- HSSFSheet s = workbook.getSheetAt(sheetNum);
- for (Row row : s) {
- for (Cell cell : row) {
- if(cell.getCellType() == CellType.STRING) {
- HSSFRichTextString rtr = (HSSFRichTextString)cell.getRichStringCellValue();
- UnicodeString u = rtr.getRawUnicodeString();
-
- // Have we done this string already?
- if(! doneUnicodeStrings.contains(u)) {
- // Update for each new position
- for(short i=5; i<newPos.length; i++) {
- if(i != newPos[i]) {
- u.swapFontUse(i, newPos[i]);
- }
- }
-
- // Mark as done
- doneUnicodeStrings.add(u);
- }
- }
- }
- }
- }
- }
+ /**
+ * Goes through the Workbook, optimising the fonts by
+ * removing duplicate ones.
+ * For now, only works on fonts used in {@link HSSFCellStyle}
+ * and {@link HSSFRichTextString}. Any other font uses
+ * (eg charts, pictures) may well end up broken!
+ * This can be a slow operation, especially if you have
+ * lots of cells, cell styles or rich text strings
+ * @param workbook The workbook in which to optimise the fonts
+ */
+ public static void optimiseFonts(HSSFWorkbook workbook) {
+ // Where each font has ended up, and if we need to
+ // delete the record for it. Start off with no change
+ short[] newPos =
+ new short[workbook.getWorkbook().getNumberOfFontRecords()+1];
+ boolean[] zapRecords = new boolean[newPos.length];
+ for(int i=0; i<newPos.length; i++) {
+ newPos[i] = (short)i;
+ zapRecords[i] = false;
+ }
+
+ // Get each font record, so we can do deletes
+ // without getting confused
+ FontRecord[] frecs = new FontRecord[newPos.length];
+ for(int i=0; i<newPos.length; i++) {
+ // There is no 4!
+ if(i == 4) continue;
+
+ frecs[i] = workbook.getWorkbook().getFontRecordAt(i);
+ }
+
+ // Loop over each font, seeing if it is the same
+ // as an earlier one. If it is, point users of the
+ // later duplicate copy to the earlier one, and
+ // mark the later one as needing deleting
+ // Note - don't change built in fonts (those before 5)
+ for(int i=5; i<newPos.length; i++) {
+ // Check this one for being a duplicate
+ // of an earlier one
+ int earlierDuplicate = -1;
+ for(int j=0; j<i && earlierDuplicate == -1; j++) {
+ if(j == 4) continue;
+
+ FontRecord frCheck = workbook.getWorkbook().getFontRecordAt(j);
+ if(frCheck.sameProperties(frecs[i])) {
+ earlierDuplicate = j;
+ }
+ }
+
+ // If we got a duplicate, mark it as such
+ if(earlierDuplicate != -1) {
+ newPos[i] = (short)earlierDuplicate;
+ zapRecords[i] = true;
+ }
+ }
+
+ // Update the new positions based on
+ // deletes that have occurred between
+ // the start and them
+ // Only need to worry about user fonts
+ for(int i=5; i<newPos.length; i++) {
+ // Find the number deleted to that
+ // point, and adjust
+ short preDeletePos = newPos[i];
+ short newPosition = preDeletePos;
+ for(int j=0; j<preDeletePos; j++) {
+ if(zapRecords[j]) newPosition--;
+ }
+
+ // Update the new position
+ newPos[i] = newPosition;
+ }
+
+ // Zap the un-needed user font records
+ for(int i=5; i<newPos.length; i++) {
+ if(zapRecords[i]) {
+ workbook.getWorkbook().removeFontRecord(
+ frecs[i]
+ );
+ }
+ }
+
+ // Tell HSSFWorkbook that it needs to
+ // re-start its HSSFFontCache
+ workbook.resetFontCache();
+
+ // Update the cell styles to point at the
+ // new locations of the fonts
+ for(int i=0; i<workbook.getWorkbook().getNumExFormats(); i++) {
+ ExtendedFormatRecord xfr = workbook.getWorkbook().getExFormatAt(i);
+ xfr.setFontIndex(
+ newPos[ xfr.getFontIndex() ]
+ );
+ }
+
+ // Update the rich text strings to point at
+ // the new locations of the fonts
+ // Remember that one underlying unicode string
+ // may be shared by multiple RichTextStrings!
+ HashSet<UnicodeString> doneUnicodeStrings = new HashSet<>();
+ for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
+ HSSFSheet s = workbook.getSheetAt(sheetNum);
+ for (Row row : s) {
+ for (Cell cell : row) {
+ if(cell.getCellType() == CellType.STRING) {
+ HSSFRichTextString rtr = (HSSFRichTextString)cell.getRichStringCellValue();
+ UnicodeString u = rtr.getRawUnicodeString();
+
+ // Have we done this string already?
+ if(! doneUnicodeStrings.contains(u)) {
+ // Update for each new position
+ for(short i=5; i<newPos.length; i++) {
+ if(i != newPos[i]) {
+ u.swapFontUse(i, newPos[i]);
+ }
+ }
+
+ // Mark as done
+ doneUnicodeStrings.add(u);
+ }
+ }
+ }
+ }
+ }
+ }
/**
* Goes through the Wokrbook, optimising the cell styles
@@ -179,43 +179,43 @@ public class HSSFOptimiser {
boolean[] isUsed = new boolean[newPos.length];
boolean[] zapRecords = new boolean[newPos.length];
- // to speed up the optimisation for workbooks with a large number of
- // styles we perform the isUserDefined() check only once as it is
- // costly according to some profiling
- boolean[] userDefined = new boolean[newPos.length];
-
- // Get each style record, so we can do deletes
- // without getting confused
- ExtendedFormatRecord[] xfrs = new ExtendedFormatRecord[newPos.length];
+ // to speed up the optimisation for workbooks with a large number of
+ // styles we perform the isUserDefined() check only once as it is
+ // costly according to some profiling
+ boolean[] userDefined = new boolean[newPos.length];
+
+ // Get each style record, so we can do deletes
+ // without getting confused
+ ExtendedFormatRecord[] xfrs = new ExtendedFormatRecord[newPos.length];
for(int i=0; i<newPos.length; i++) {
isUsed[i] = false;
newPos[i] = (short)i;
zapRecords[i] = false;
- userDefined[i] = isUserDefined(workbook, i);
+ userDefined[i] = isUserDefined(workbook, i);
- xfrs[i] = workbook.getWorkbook().getExFormatAt(i);
+ xfrs[i] = workbook.getWorkbook().getExFormatAt(i);
}
- // Loop over each style, seeing if it is the same
- // as an earlier one. If it is, point users of the
- // later duplicate copy to the earlier one, and
- // mark the later one as needing deleting
- // Only work on user added ones, which come after 20
- for (int i = 21; i < newPos.length; i++) {
- // Check this one for being a duplicate
- // of an earlier one
- int earlierDuplicate = -1;
- for (int j = 0; j < i; j++) {
- ExtendedFormatRecord xfCheck = workbook.getWorkbook().getExFormatAt(j);
- if (xfCheck.equals(xfrs[i]) &&
- // never duplicate user defined styles
- !userDefined[j]) {
- earlierDuplicate = j;
- break;
- }
- }
+ // Loop over each style, seeing if it is the same
+ // as an earlier one. If it is, point users of the
+ // later duplicate copy to the earlier one, and
+ // mark the later one as needing deleting
+ // Only work on user added ones, which come after 20
+ for (int i = 21; i < newPos.length; i++) {
+ // Check this one for being a duplicate
+ // of an earlier one
+ int earlierDuplicate = -1;
+ for (int j = 0; j < i; j++) {
+ ExtendedFormatRecord xfCheck = workbook.getWorkbook().getExFormatAt(j);
+ if (xfCheck.equals(xfrs[i]) &&
+ // never duplicate user defined styles
+ !userDefined[j]) {
+ earlierDuplicate = j;
+ break;
+ }
+ }
// If we got a duplicate, mark it as such
if(earlierDuplicate != -1) {
@@ -224,50 +224,50 @@ public class HSSFOptimiser {
}
}
- // Loop over all the cells in the file, and identify any user defined
- // styles aren't actually being used (don't touch built-in ones)
- for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
- HSSFSheet s = workbook.getSheetAt(sheetNum);
- for (Row row : s) {
- for (Cell cellI : row) {
- HSSFCell cell = (HSSFCell) cellI;
- short oldXf = cell.getCellValueRecord().getXFIndex();
- // some documents contain invalid values here
- if(oldXf < newPos.length) {
- isUsed[oldXf] = true;
- }
- }
-
- // also mark row style as being used
- short oldXf = ((HSSFRow) row).getRowRecord().getXFIndex();
- // some documents contain invalid values here
- if(oldXf < newPos.length) {
- isUsed[oldXf] = true;
- }
- }
-
- // also mark column styles as being used
- for (int col = s.getSheet().getMinColumnIndex(); col <= s.getSheet().getMaxColumnIndex(); col++) {
- short oldXf = s.getSheet().getXFIndexForColAt((short) col);
- // some documents contain invalid values here
- if(oldXf < newPos.length) {
- isUsed[oldXf] = true;
- }
- }
- }
-
- // Propagate isUsed for duplicates and always set user styles to being used to never optimize them away
- for (int i = 21; i < isUsed.length; i++) {
- // user defined styles are always "used"
- if (isUserDefined(workbook, i)) {
- isUsed[i] = true;
- }
-
- // If we got a duplicate which is used, mark the one we're keeping as used
- if(newPos[i] != i && isUsed[i]) {
- isUsed[newPos[i]] = true;
- }
- }
+ // Loop over all the cells in the file, and identify any user defined
+ // styles aren't actually being used (don't touch built-in ones)
+ for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
+ HSSFSheet s = workbook.getSheetAt(sheetNum);
+ for (Row row : s) {
+ for (Cell cellI : row) {
+ HSSFCell cell = (HSSFCell) cellI;
+ short oldXf = cell.getCellValueRecord().getXFIndex();
+ // some documents contain invalid values here
+ if(oldXf < newPos.length) {
+ isUsed[oldXf] = true;
+ }
+ }
+
+ // also mark row style as being used
+ short oldXf = ((HSSFRow) row).getRowRecord().getXFIndex();
+ // some documents contain invalid values here
+ if(oldXf < newPos.length) {
+ isUsed[oldXf] = true;
+ }
+ }
+
+ // also mark column styles as being used
+ for (int col = s.getSheet().getMinColumnIndex(); col <= s.getSheet().getMaxColumnIndex(); col++) {
+ short oldXf = s.getSheet().getXFIndexForColAt((short) col);
+ // some documents contain invalid values here
+ if(oldXf < newPos.length) {
+ isUsed[oldXf] = true;
+ }
+ }
+ }
+
+ // Propagate isUsed for duplicates and always set user styles to being used to never optimize them away
+ for (int i = 21; i < isUsed.length; i++) {
+ // user defined styles are always "used"
+ if (isUserDefined(workbook, i)) {
+ isUsed[i] = true;
+ }
+
+ // If we got a duplicate which is used, mark the one we're keeping as used
+ if(newPos[i] != i && isUsed[i]) {
+ isUsed[newPos[i]] = true;
+ }
+ }
// Mark any that aren't used as needing zapping
for (int i=21; i<isUsed.length; i++) {
@@ -291,21 +291,21 @@ public class HSSFOptimiser {
if(zapRecords[j]) newPosition--;
}
- // Update the new position
- newPos[i] = newPosition;
- // also update StyleRecord and Parent-link
- if (i != newPosition && newPosition != 0) {
- workbook.getWorkbook().updateStyleRecord(i, newPosition);
-
- ExtendedFormatRecord exFormat = workbook.getWorkbook().getExFormatAt(i);
- short oldParent = exFormat.getParentIndex();
- // some documents contain invalid values here
- if(oldParent < newPos.length) {
- short newParent = newPos[oldParent];
- exFormat.setParentIndex(newParent);
- }
- }
- }
+ // Update the new position
+ newPos[i] = newPosition;
+ // also update StyleRecord and Parent-link
+ if (i != newPosition && newPosition != 0) {
+ workbook.getWorkbook().updateStyleRecord(i, newPosition);
+
+ ExtendedFormatRecord exFormat = workbook.getWorkbook().getExFormatAt(i);
+ short oldParent = exFormat.getParentIndex();
+ // some documents contain invalid values here
+ if(oldParent < newPos.length) {
+ short newParent = newPos[oldParent];
+ exFormat.setParentIndex(newParent);
+ }
+ }
+ }
// Zap the un-needed user style records
// removing by index, because removing by object may delete
@@ -321,47 +321,47 @@ public class HSSFOptimiser {
}
}
- // Finally, update the cells to point at their new extended format records
- for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
- HSSFSheet s = workbook.getSheetAt(sheetNum);
- for (Row row : s) {
- for (Cell cell : row) {
- short oldXf = ((HSSFCell) cell).getCellValueRecord().getXFIndex();
- // some documents contain invalid values here
- if(oldXf >= newPos.length) {
- continue;
- }
- HSSFCellStyle newStyle = workbook.getCellStyleAt(newPos[oldXf]);
- cell.setCellStyle(newStyle);
- }
-
- // adjust row column style
- short oldXf = ((HSSFRow) row).getRowRecord().getXFIndex();
- // some documents contain invalid values here
- if(oldXf >= newPos.length) {
- continue;
- }
- HSSFCellStyle newStyle = workbook.getCellStyleAt(newPos[oldXf]);
- row.setRowStyle(newStyle);
- }
-
- // adjust cell column style
- for (int col = s.getSheet().getMinColumnIndex(); col <= s.getSheet().getMaxColumnIndex(); col++) {
- short oldXf = s.getSheet().getXFIndexForColAt((short) col);
- // some documents contain invalid values here
- if(oldXf >= newPos.length) {
- continue;
- }
- HSSFCellStyle newStyle = workbook.getCellStyleAt(newPos[oldXf]);
- s.setDefaultColumnStyle(col, newStyle);
- }
- }
+ // Finally, update the cells to point at their new extended format records
+ for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
+ HSSFSheet s = workbook.getSheetAt(sheetNum);
+ for (Row row : s) {
+ for (Cell cell : row) {
+ short oldXf = ((HSSFCell) cell).getCellValueRecord().getXFIndex();
+ // some documents contain invalid values here
+ if(oldXf >= newPos.length) {
+ continue;
+ }
+ HSSFCellStyle newStyle = workbook.getCellStyleAt(newPos[oldXf]);
+ cell.setCellStyle(newStyle);
+ }
+
+ // adjust row column style
+ short oldXf = ((HSSFRow) row).getRowRecord().getXFIndex();
+ // some documents contain invalid values here
+ if(oldXf >= newPos.length) {
+ continue;
+ }
+ HSSFCellStyle newStyle = workbook.getCellStyleAt(newPos[oldXf]);
+ row.setRowStyle(newStyle);
+ }
+
+ // adjust cell column style
+ for (int col = s.getSheet().getMinColumnIndex(); col <= s.getSheet().getMaxColumnIndex(); col++) {
+ short oldXf = s.getSheet().getXFIndexForColAt((short) col);
+ // some documents contain invalid values here
+ if(oldXf >= newPos.length) {
+ continue;
+ }
+ HSSFCellStyle newStyle = workbook.getCellStyleAt(newPos[oldXf]);
+ s.setDefaultColumnStyle(col, newStyle);
+ }
+ }
}
- private static boolean isUserDefined(HSSFWorkbook workbook, int index) {
- StyleRecord styleRecord = workbook.getWorkbook().getStyleRecord(index);
- return styleRecord != null &&
- !styleRecord.isBuiltin() &&
- styleRecord.getName() != null;
- }
+ private static boolean isUserDefined(HSSFWorkbook workbook, int index) {
+ StyleRecord styleRecord = workbook.getWorkbook().getStyleRecord(index);
+ return styleRecord != null &&
+ !styleRecord.isBuiltin() &&
+ styleRecord.getName() != null;
+ }
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java Sat May 22 20:56:44 2021
@@ -60,7 +60,7 @@ public final class HSSFPalette {
* @return the color, or null if the index is not populated
*/
public HSSFColor getColor(int index) {
- return getColor((short)index);
+ return getColor((short)index);
}
/**
@@ -97,7 +97,7 @@ public final class HSSFPalette {
* colors currently defined.
*/
public HSSFColor findSimilarColor(byte red, byte green, byte blue) {
- return findSimilarColor(unsignedInt(red), unsignedInt(green), unsignedInt(blue));
+ return findSimilarColor(unsignedInt(red), unsignedInt(green), unsignedInt(blue));
}
/**
* Finds the closest matching color in the custom palette. The
@@ -118,8 +118,8 @@ public final class HSSFPalette {
b = _palette.getColor(++i))
{
int colorDistance = Math.abs(red - unsignedInt(b[0])) +
- Math.abs(green - unsignedInt(b[1])) +
- Math.abs(blue - unsignedInt(b[2]));
+ Math.abs(green - unsignedInt(b[1])) +
+ Math.abs(blue - unsignedInt(b[2]));
if (colorDistance < minColorDistance)
{
minColorDistance = colorDistance;
@@ -134,7 +134,7 @@ public final class HSSFPalette {
* 0 and 255, so distance calculations work as expected.
*/
private int unsignedInt(byte b) {
- return 0xFF & b;
+ return 0xFF & b;
}
/**
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java Sat May 22 20:56:44 2021
@@ -238,19 +238,19 @@ public final class HSSFPatriarch impleme
FtCfSubRecord ftCf = new FtCfSubRecord();
HSSFPictureData pictData = getSheet().getWorkbook().getAllPictures().get(pictureIndex-1);
switch (pictData.getFormat()) {
- case Workbook.PICTURE_TYPE_WMF:
- case Workbook.PICTURE_TYPE_EMF:
- // this needs patch #49658 to be applied to actually work
- ftCf.setFlags(FtCfSubRecord.METAFILE_BIT);
- break;
- case Workbook.PICTURE_TYPE_DIB:
- case Workbook.PICTURE_TYPE_PNG:
- case Workbook.PICTURE_TYPE_JPEG:
- case Workbook.PICTURE_TYPE_PICT:
- ftCf.setFlags(FtCfSubRecord.BITMAP_BIT);
- break;
- default:
- throw new IllegalStateException("Invalid picture type: " + pictData.getFormat());
+ case Workbook.PICTURE_TYPE_WMF:
+ case Workbook.PICTURE_TYPE_EMF:
+ // this needs patch #49658 to be applied to actually work
+ ftCf.setFlags(FtCfSubRecord.METAFILE_BIT);
+ break;
+ case Workbook.PICTURE_TYPE_DIB:
+ case Workbook.PICTURE_TYPE_PNG:
+ case Workbook.PICTURE_TYPE_JPEG:
+ case Workbook.PICTURE_TYPE_PICT:
+ ftCf.setFlags(FtCfSubRecord.BITMAP_BIT);
+ break;
+ default:
+ throw new IllegalStateException("Invalid picture type: " + pictData.getFormat());
}
obj.addSubRecord(ftCf);
// FtPioGrbit (pictFlags)
@@ -270,12 +270,12 @@ public final class HSSFPatriarch impleme
DirectoryEntry oleRoot;
try {
DirectoryNode dn = _sheet.getWorkbook().getDirectory();
- if (dn == null) {
+ if (dn == null) {
throw new FileNotFoundException();
}
- oleRoot = (DirectoryEntry)dn.getEntry(entryName);
+ oleRoot = (DirectoryEntry)dn.getEntry(entryName);
} catch (FileNotFoundException e) {
- throw new IllegalStateException("trying to add ole shape without actually adding data first - use HSSFWorkbook.addOlePackage first", e);
+ throw new IllegalStateException("trying to add ole shape without actually adding data first - use HSSFWorkbook.addOlePackage first", e);
}
// create picture shape, which need to be minimal modified for oleshapes
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPicture.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPicture.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPicture.java Sat May 22 20:56:44 2021
@@ -218,8 +218,8 @@ public class HSSFPicture extends HSSFSim
InternalWorkbook iwb = patriarch.getSheet().getWorkbook().getWorkbook();
EscherBSERecord bse = iwb.getBSERecord(picIdx);
- EscherBlipRecord blipRecord = bse.getBlipRecord();
- return new HSSFPictureData(blipRecord);
+ EscherBlipRecord blipRecord = bse.getBlipRecord();
+ return new HSSFPictureData(blipRecord);
}
@Override
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPolygon.java Sat May 22 20:56:44 2021
@@ -176,11 +176,11 @@ public class HSSFPolygon extends HSSFSi
*/
public void setPoints(int[] xPoints, int[] yPoints) {
if (xPoints.length != yPoints.length){
- LOG.atError().log("xPoint.length must be equal to yPoints.length");
+ LOG.atError().log("xPoint.length must be equal to yPoints.length");
return;
}
if (xPoints.length == 0){
- LOG.atError().log("HSSFPolygon must have at least one point");
+ LOG.atError().log("HSSFPolygon must have at least one point");
}
EscherArrayProperty verticesProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__VERTICES, false, 0);
verticesProp.setNumberOfElementsInArray(xPoints.length+1);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPrintSetup.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPrintSetup.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPrintSetup.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPrintSetup.java Sat May 22 20:56:44 2021
@@ -27,14 +27,14 @@ import org.apache.poi.ss.usermodel.Print
* Paper size constants have been added for the ones I have access
* to. They follow as:<br>
* public static final short PRINTER_DEFAULT_PAPERSIZE = 0;<br>
- * public static final short LETTER_PAPERSIZE = 1;<br>
- * public static final short LEGAL_PAPERSIZE = 5;<br>
- * public static final short EXECUTIVE_PAPERSIZE = 7;<br>
- * public static final short A4_PAPERSIZE = 9;<br>
- * public static final short A5_PAPERSIZE = 11;<br>
- * public static final short ENVELOPE_10_PAPERSIZE = 20;<br>
- * public static final short ENVELOPE_DL_PAPERSIZE = 27;<br>
- * public static final short ENVELOPE_CS_PAPERSIZE = 28;<br>
+ * public static final short LETTER_PAPERSIZE = 1;<br>
+ * public static final short LEGAL_PAPERSIZE = 5;<br>
+ * public static final short EXECUTIVE_PAPERSIZE = 7;<br>
+ * public static final short A4_PAPERSIZE = 9;<br>
+ * public static final short A5_PAPERSIZE = 11;<br>
+ * public static final short ENVELOPE_10_PAPERSIZE = 20;<br>
+ * public static final short ENVELOPE_DL_PAPERSIZE = 27;<br>
+ * public static final short ENVELOPE_CS_PAPERSIZE = 28;<br>
* public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
*/
public class HSSFPrintSetup implements PrintSetup {
@@ -45,7 +45,7 @@ public class HSSFPrintSetup implements P
* @param printSetupRecord the low level print setup record
*/
protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
- this.printSetupRecord = printSetupRecord;
+ this.printSetupRecord = printSetupRecord;
}
/**
@@ -53,7 +53,7 @@ public class HSSFPrintSetup implements P
* @param size the paper size.
*/
public void setPaperSize(short size) {
- printSetupRecord.setPaperSize(size);
+ printSetupRecord.setPaperSize(size);
}
/**
@@ -61,7 +61,7 @@ public class HSSFPrintSetup implements P
* @param scale the scale to use
*/
public void setScale(short scale) {
- printSetupRecord.setScale(scale);
+ printSetupRecord.setScale(scale);
}
/**
@@ -69,7 +69,7 @@ public class HSSFPrintSetup implements P
* @param start the page numbering start
*/
public void setPageStart(short start) {
- printSetupRecord.setPageStart(start);
+ printSetupRecord.setPageStart(start);
}
/**
@@ -77,7 +77,7 @@ public class HSSFPrintSetup implements P
* @param width the number of pages
*/
public void setFitWidth(short width) {
- printSetupRecord.setFitWidth(width);
+ printSetupRecord.setFitWidth(width);
}
/**
@@ -85,7 +85,7 @@ public class HSSFPrintSetup implements P
* @param height the number of pages
*/
public void setFitHeight(short height) {
- printSetupRecord.setFitHeight(height);
+ printSetupRecord.setFitHeight(height);
}
/**
@@ -93,7 +93,7 @@ public class HSSFPrintSetup implements P
* @param options The bit flags for the options
*/
public void setOptions(short options) {
- printSetupRecord.setOptions(options);
+ printSetupRecord.setOptions(options);
}
/**
@@ -101,7 +101,7 @@ public class HSSFPrintSetup implements P
* @param ltor left to right
*/
public void setLeftToRight(boolean ltor) {
- printSetupRecord.setLeftToRight(ltor);
+ printSetupRecord.setLeftToRight(ltor);
}
/**
@@ -109,7 +109,7 @@ public class HSSFPrintSetup implements P
* @param ls landscape
*/
public void setLandscape(boolean ls) {
- printSetupRecord.setLandscape(!ls);
+ printSetupRecord.setLandscape(!ls);
}
/**
@@ -117,7 +117,7 @@ public class HSSFPrintSetup implements P
* @param valid Valid
*/
public void setValidSettings(boolean valid) {
- printSetupRecord.setValidSettings(valid);
+ printSetupRecord.setValidSettings(valid);
}
/**
@@ -125,7 +125,7 @@ public class HSSFPrintSetup implements P
* @param mono Black and white
*/
public void setNoColor(boolean mono) {
- printSetupRecord.setNoColor(mono);
+ printSetupRecord.setNoColor(mono);
}
/**
@@ -133,7 +133,7 @@ public class HSSFPrintSetup implements P
* @param d draft
*/
public void setDraft(boolean d) {
- printSetupRecord.setDraft(d);
+ printSetupRecord.setDraft(d);
}
/**
@@ -141,7 +141,7 @@ public class HSSFPrintSetup implements P
* @param printnotes print the notes
*/
public void setNotes(boolean printnotes) {
- printSetupRecord.setNotes(printnotes);
+ printSetupRecord.setNotes(printnotes);
}
/**
@@ -149,7 +149,7 @@ public class HSSFPrintSetup implements P
* @param orientation Orientation.
*/
public void setNoOrientation(boolean orientation) {
- printSetupRecord.setNoOrientation(orientation);
+ printSetupRecord.setNoOrientation(orientation);
}
/**
@@ -157,7 +157,7 @@ public class HSSFPrintSetup implements P
* @param page Use page start
*/
public void setUsePage(boolean page) {
- printSetupRecord.setUsePage(page);
+ printSetupRecord.setUsePage(page);
}
/**
@@ -165,7 +165,7 @@ public class HSSFPrintSetup implements P
* @param resolution horizontal resolution
*/
public void setHResolution(short resolution) {
- printSetupRecord.setHResolution(resolution);
+ printSetupRecord.setHResolution(resolution);
}
/**
@@ -173,7 +173,7 @@ public class HSSFPrintSetup implements P
* @param resolution vertical resolution
*/
public void setVResolution(short resolution) {
- printSetupRecord.setVResolution(resolution);
+ printSetupRecord.setVResolution(resolution);
}
/**
@@ -181,7 +181,7 @@ public class HSSFPrintSetup implements P
* @param headermargin header margin
*/
public void setHeaderMargin(double headermargin) {
- printSetupRecord.setHeaderMargin(headermargin);
+ printSetupRecord.setHeaderMargin(headermargin);
}
/**
@@ -189,7 +189,7 @@ public class HSSFPrintSetup implements P
* @param footermargin footer margin
*/
public void setFooterMargin(double footermargin) {
- printSetupRecord.setFooterMargin(footermargin);
+ printSetupRecord.setFooterMargin(footermargin);
}
/**
@@ -197,7 +197,7 @@ public class HSSFPrintSetup implements P
* @param copies number of copies
*/
public void setCopies(short copies) {
- printSetupRecord.setCopies(copies);
+ printSetupRecord.setCopies(copies);
}
/**
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java Sat May 22 20:56:44 2021
@@ -217,7 +217,7 @@ public final class HSSFRichTextString im
* other RichTextStrings too!
*/
UnicodeString getRawUnicodeString() {
- return _string;
+ return _string;
}
/** Used internally by the HSSFCell to set the internal string value*/
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java Sat May 22 20:56:44 2021
@@ -105,7 +105,7 @@ public class HSSFShapeFactory {
case CommonObjectDataSubRecord.OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING:
EscherOptRecord optRecord = container.getChildById(EscherOptRecord.RECORD_ID);
if(optRecord == null) {
- shape = new HSSFSimpleShape(container, objRecord, txtRecord);
+ shape = new HSSFSimpleShape(container, objRecord, txtRecord);
} else {
EscherProperty property = optRecord.lookup(EscherPropertyTypes.GEOMETRY__VERTICES);
if (null != property) {
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java?rev=1890120&r1=1890119&r2=1890120&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java Sat May 22 20:56:44 2021
@@ -48,16 +48,16 @@ public final class HSSFSheetConditionalF
* TODO - formulas containing cell references are currently not parsed properly
*
* @param comparisonOperation - a constant value from
- * {@code {@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator}}:
+ * {@code {@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator}}:
* <ul>
- * <li>BETWEEN</li>
- * <li>NOT_BETWEEN</li>
- * <li>EQUAL</li>
- * <li>NOT_EQUAL</li>
- * <li>GT</li>
- * <li>LT</li>
- * <li>GE</li>
- * <li>LE</li>
+ * <li>BETWEEN</li>
+ * <li>NOT_BETWEEN</li>
+ * <li>EQUAL</li>
+ * <li>NOT_EQUAL</li>
+ * <li>GT</li>
+ * <li>LT</li>
+ * <li>GE</li>
+ * <li>LE</li>
* </ul>
*
* @param formula1 - formula for the valued, compared with the cell
@@ -247,7 +247,7 @@ public final class HSSFSheetConditionalF
* gets Conditional Formatting object at a particular index
*
* @param index
- * of the Conditional Formatting object to fetch
+ * of the Conditional Formatting object to fetch
* @return Conditional Formatting object
*/
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org