Typos and IDE warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1844879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8f11f0010e
commit
2148b7f278
@ -142,13 +142,13 @@ import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
|
|||||||
public class AddDimensionedImage {
|
public class AddDimensionedImage {
|
||||||
|
|
||||||
// Four constants that determine how - and indeed whether - the rows
|
// Four constants that determine how - and indeed whether - the rows
|
||||||
// and columns an image may overlie should be expanded to accomodate that
|
// and columns an image may overlie should be expanded to accommodate that
|
||||||
// image.
|
// image.
|
||||||
// Passing EXPAND_ROW will result in the height of a row being increased
|
// Passing EXPAND_ROW will result in the height of a row being increased
|
||||||
// to accomodate the image if it is not already larger. The image will
|
// to accommodate the image if it is not already larger. The image will
|
||||||
// be layed across one or more columns.
|
// be layed across one or more columns.
|
||||||
// Passing EXPAND_COLUMN will result in the width of the column being
|
// Passing EXPAND_COLUMN will result in the width of the column being
|
||||||
// increased to accomodate the image if it is not already larger. The image
|
// increased to accommodate the image if it is not already larger. The image
|
||||||
// will be layed across one or many rows.
|
// will be layed across one or many rows.
|
||||||
// Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
|
// Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
|
||||||
// bing increased along with the width of the column to accomdate the
|
// bing increased along with the width of the column to accomdate the
|
||||||
@ -266,7 +266,7 @@ public class AddDimensionedImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call methods to calculate how the image and sheet should be
|
// Call methods to calculate how the image and sheet should be
|
||||||
// manipulated to accomodate the image; columns and then rows.
|
// manipulated to accommodate the image; columns and then rows.
|
||||||
colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
|
colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
|
||||||
reqImageWidthMM, resizeBehaviour);
|
reqImageWidthMM, resizeBehaviour);
|
||||||
rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
|
rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
|
||||||
@ -312,7 +312,7 @@ public class AddDimensionedImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the sheets columns should be re-sized to accomodate
|
* Determines whether the sheets columns should be re-sized to accommodate
|
||||||
* the image, adjusts the columns width if necessary and creates then
|
* the image, adjusts the columns width if necessary and creates then
|
||||||
* returns a ClientAnchorDetail object that facilitates construction of
|
* returns a ClientAnchorDetail object that facilitates construction of
|
||||||
* an HSSFClientAnchor that will fix the image on the sheet and establish
|
* an HSSFClientAnchor that will fix the image on the sheet and establish
|
||||||
@ -348,7 +348,7 @@ public class AddDimensionedImage {
|
|||||||
colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
|
colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
|
||||||
(short)sheet.getColumnWidth(colNumber));
|
(short)sheet.getColumnWidth(colNumber));
|
||||||
|
|
||||||
// Check that the column's width will accomodate the image at the
|
// Check that the column's width will accommodate the image at the
|
||||||
// required dimension. If the width of the column is LESS than the
|
// required dimension. If the width of the column is LESS than the
|
||||||
// required width of the image, decide how the application should
|
// required width of the image, decide how the application should
|
||||||
// respond - resize the column or overlay the image across one or more
|
// respond - resize the column or overlay the image across one or more
|
||||||
@ -396,7 +396,7 @@ public class AddDimensionedImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the sheet's row should be re-sized to accomodate
|
* Determines whether the sheet's row should be re-sized to accommodate
|
||||||
* the image, adjusts the rows height if necessary and creates then
|
* the image, adjusts the rows height if necessary and creates then
|
||||||
* returns a ClientAnchorDetail object that facilitates construction of
|
* returns a ClientAnchorDetail object that facilitates construction of
|
||||||
* an HSSFClientAnchor that will fix the image on the sheet and establish
|
* an HSSFClientAnchor that will fix the image on the sheet and establish
|
||||||
@ -436,7 +436,7 @@ public class AddDimensionedImage {
|
|||||||
// Get the row's height in millimetres
|
// Get the row's height in millimetres
|
||||||
double rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
|
double rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
|
||||||
|
|
||||||
// Check that the row's height will accomodate the image at the required
|
// Check that the row's height will accommodate the image at the required
|
||||||
// dimensions. If the height of the row is LESS than the required height
|
// dimensions. If the height of the row is LESS than the required height
|
||||||
// of the image, decide how the application should respond - resize the
|
// of the image, decide how the application should respond - resize the
|
||||||
// row or overlay the image across a series of rows.
|
// row or overlay the image across a series of rows.
|
||||||
|
@ -202,13 +202,13 @@ import org.apache.poi.util.IOUtils;
|
|||||||
public class AddDimensionedImage {
|
public class AddDimensionedImage {
|
||||||
|
|
||||||
// Four constants that determine how - and indeed whether - the rows
|
// Four constants that determine how - and indeed whether - the rows
|
||||||
// and columns an image may overlie should be expanded to accomodate that
|
// and columns an image may overlie should be expanded to accommodate that
|
||||||
// image.
|
// image.
|
||||||
// Passing EXPAND_ROW will result in the height of a row being increased
|
// Passing EXPAND_ROW will result in the height of a row being increased
|
||||||
// to accomodate the image if it is not already larger. The image will
|
// to accommodate the image if it is not already larger. The image will
|
||||||
// be layed across one or more columns.
|
// be layed across one or more columns.
|
||||||
// Passing EXPAND_COLUMN will result in the width of the column being
|
// Passing EXPAND_COLUMN will result in the width of the column being
|
||||||
// increased to accomodate the image if it is not already larger. The image
|
// increased to accommodate the image if it is not already larger. The image
|
||||||
// will be layed across one or many rows.
|
// will be layed across one or many rows.
|
||||||
// Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
|
// Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
|
||||||
// bing increased along with the width of the column to accomdate the
|
// bing increased along with the width of the column to accomdate the
|
||||||
@ -348,7 +348,7 @@ public class AddDimensionedImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call methods to calculate how the image and sheet should be
|
// Call methods to calculate how the image and sheet should be
|
||||||
// manipulated to accomodate the image; columns and then rows.
|
// manipulated to accommodate the image; columns and then rows.
|
||||||
colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
|
colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
|
||||||
reqImageWidthMM, resizeBehaviour);
|
reqImageWidthMM, resizeBehaviour);
|
||||||
rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
|
rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
|
||||||
@ -440,7 +440,7 @@ public class AddDimensionedImage {
|
|||||||
colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
|
colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
|
||||||
(short)sheet.getColumnWidth(colNumber));
|
(short)sheet.getColumnWidth(colNumber));
|
||||||
|
|
||||||
// Check that the column's width will accomodate the image at the
|
// Check that the column's width will accommodate the image at the
|
||||||
// required dimension. If the width of the column is LESS than the
|
// required dimension. If the width of the column is LESS than the
|
||||||
// required width of the image, decide how the application should
|
// required width of the image, decide how the application should
|
||||||
// respond - resize the column or overlay the image across one or more
|
// respond - resize the column or overlay the image across one or more
|
||||||
@ -500,7 +500,7 @@ public class AddDimensionedImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the sheets row should be re-sized to accomodate
|
* Determines whether the sheets row should be re-sized to accommodate
|
||||||
* the image, adjusts the rows height if necessary and creates then
|
* the image, adjusts the rows height if necessary and creates then
|
||||||
* returns a ClientAnchorDetail object that facilitates construction of
|
* returns a ClientAnchorDetail object that facilitates construction of
|
||||||
* a ClientAnchor that will fix the image on the sheet and establish
|
* a ClientAnchor that will fix the image on the sheet and establish
|
||||||
@ -542,7 +542,7 @@ public class AddDimensionedImage {
|
|||||||
// Get the row's height in millimetres
|
// Get the row's height in millimetres
|
||||||
rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
|
rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
|
||||||
|
|
||||||
// Check that the row's height will accomodate the image at the required
|
// Check that the row's height will accommodate the image at the required
|
||||||
// dimensions. If the height of the row is LESS than the required height
|
// dimensions. If the height of the row is LESS than the required height
|
||||||
// of the image, decide how the application should respond - resize the
|
// of the image, decide how the application should respond - resize the
|
||||||
// row or overlay the image across a series of rows.
|
// row or overlay the image across a series of rows.
|
||||||
|
@ -44,8 +44,8 @@ public class NewLinesInCells {
|
|||||||
cs.setWrapText(true);
|
cs.setWrapText(true);
|
||||||
cell.setCellStyle(cs);
|
cell.setCellStyle(cs);
|
||||||
|
|
||||||
//increase row height to accomodate two lines of text
|
//increase row height to accommodate two lines of text
|
||||||
row.setHeightInPoints((2 * sheet.getDefaultRowHeightInPoints()));
|
row.setHeightInPoints(2 * sheet.getDefaultRowHeightInPoints());
|
||||||
|
|
||||||
//adjust column width to fit the content
|
//adjust column width to fit the content
|
||||||
sheet.autoSizeColumn(2);
|
sheet.autoSizeColumn(2);
|
||||||
@ -55,5 +55,4 @@ public class NewLinesInCells {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ public class CellDateFormatter extends CellFormatter {
|
|||||||
private int hStart = -1;
|
private int hStart = -1;
|
||||||
private int hLen;
|
private int hLen;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String handlePart(Matcher m, String part, CellFormatType type,
|
public String handlePart(Matcher m, String part, CellFormatType type,
|
||||||
StringBuffer desc) {
|
StringBuffer desc) {
|
||||||
|
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
==================================================================== */
|
==================================================================== */
|
||||||
package org.apache.poi.ss.format;
|
package org.apache.poi.ss.format;
|
||||||
|
|
||||||
import org.apache.poi.ss.format.CellFormatPart.PartHandler;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements printing out text.
|
* This class implements printing out text.
|
||||||
@ -38,15 +35,12 @@ public class CellTextFormatter extends CellFormatter {
|
|||||||
final int[] numPlaces = new int[1];
|
final int[] numPlaces = new int[1];
|
||||||
|
|
||||||
desc = CellFormatPart.parseFormat(format, CellFormatType.TEXT,
|
desc = CellFormatPart.parseFormat(format, CellFormatType.TEXT,
|
||||||
new PartHandler() {
|
(m, part, type, desc) -> {
|
||||||
public String handlePart(Matcher m, String part,
|
if (part.equals("@")) {
|
||||||
CellFormatType type, StringBuffer desc) {
|
numPlaces[0]++;
|
||||||
if (part.equals("@")) {
|
return "\u0000";
|
||||||
numPlaces[0]++;
|
|
||||||
return "\u0000";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}).toString();
|
}).toString();
|
||||||
|
|
||||||
// Remember the "@" positions in last-to-first order (to make insertion easier)
|
// Remember the "@" positions in last-to-first order (to make insertion easier)
|
||||||
@ -66,8 +60,8 @@ public class CellTextFormatter extends CellFormatter {
|
|||||||
text = text.toUpperCase(Locale.ROOT);
|
text = text.toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
toAppendTo.append(desc);
|
toAppendTo.append(desc);
|
||||||
for (int i = 0; i < textPos.length; i++) {
|
for (int textPo : textPos) {
|
||||||
int pos = start + textPos[i];
|
int pos = start + textPo;
|
||||||
toAppendTo.replace(pos, pos + 1, text);
|
toAppendTo.replace(pos, pos + 1, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public abstract class RefPtgBase extends OperandPtg {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* YK: subclasses of RefPtgBase are used by the FormulaParser and FormulaEvaluator accross HSSF and XSSF.
|
* YK: subclasses of RefPtgBase are used by the FormulaParser and FormulaEvaluator accross HSSF and XSSF.
|
||||||
* The bit mask should accomodate the maximum number of avaiable columns, i.e. 0x3FFF.
|
* The bit mask should accommodate the maximum number of avaiable columns, i.e. 0x3FFF.
|
||||||
*
|
*
|
||||||
* @see org.apache.poi.ss.SpreadsheetVersion
|
* @see org.apache.poi.ss.SpreadsheetVersion
|
||||||
*/
|
*/
|
||||||
|
@ -420,7 +420,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named short value form the given map.
|
* Utility method that returns the named short value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of named properties (String -> Object)
|
* @param properties map of named properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
@ -436,7 +436,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named int value form the given map.
|
* Utility method that returns the named int value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of named properties (String -> Object)
|
* @param properties map of named properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
@ -452,7 +452,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named BorderStyle value form the given map.
|
* Utility method that returns the named BorderStyle value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of named properties (String -> Object)
|
* @param properties map of named properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
@ -483,7 +483,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named FillPatternType value form the given map.
|
* Utility method that returns the named FillPatternType value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of named properties (String -> Object)
|
* @param properties map of named properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
@ -515,7 +515,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named HorizontalAlignment value form the given map.
|
* Utility method that returns the named HorizontalAlignment value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of named properties (String -> Object)
|
* @param properties map of named properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
@ -547,7 +547,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named VerticalAlignment value form the given map.
|
* Utility method that returns the named VerticalAlignment value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of named properties (String -> Object)
|
* @param properties map of named properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
@ -579,7 +579,7 @@ public final class CellUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that returns the named boolean value form the given map.
|
* Utility method that returns the named boolean value from the given map.
|
||||||
*
|
*
|
||||||
* @param properties map of properties (String -> Object)
|
* @param properties map of properties (String -> Object)
|
||||||
* @param name property name
|
* @param name property name
|
||||||
|
@ -2993,13 +2993,21 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
|||||||
cell.setCellStyle(style);
|
cell.setCellStyle(style);
|
||||||
|
|
||||||
// Everything is fine at this point, cell is red
|
// Everything is fine at this point, cell is red
|
||||||
|
XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor();
|
||||||
|
assertNull(actual);
|
||||||
|
actual = cell.getCellStyle().getFillForegroundColorColor();
|
||||||
|
assertNotNull(actual);
|
||||||
|
assertEquals(color.getARGBHex(), actual.getARGBHex());
|
||||||
|
|
||||||
Map<String, Object> properties = new HashMap<>();
|
Map<String, Object> properties = new HashMap<>();
|
||||||
properties.put(CellUtil.BORDER_BOTTOM, BorderStyle.THIN);
|
properties.put(CellUtil.BORDER_BOTTOM, BorderStyle.THIN);
|
||||||
CellUtil.setCellStyleProperties(cell, properties);
|
CellUtil.setCellStyleProperties(cell, properties);
|
||||||
|
|
||||||
// Now the cell is all black
|
// Now the cell is all black
|
||||||
XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor();
|
actual = cell.getCellStyle().getFillBackgroundColorColor();
|
||||||
|
assertNotNull(actual);
|
||||||
|
assertNull(actual.getARGBHex());
|
||||||
|
actual = cell.getCellStyle().getFillForegroundColorColor();
|
||||||
assertNotNull(actual);
|
assertNotNull(actual);
|
||||||
assertEquals(color.getARGBHex(), actual.getARGBHex());
|
assertEquals(color.getARGBHex(), actual.getARGBHex());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user