totalWidthMM += (colWidthMM + ConvertImageUnits.CELL_BORDER_WIDTH_MILLIMETRES);
toColumn++;
}
- // De-crement by one the last column value.
+ // De-rement by one the last column value.
toColumn--;
// Highly unlikely that this will be true but, if the width of a series
// of columns is exactly equal to the required width of the image, then
/**
* Specifies the line end decoration, such as a triangle or arrowhead.
*
- * @param style the line end docoration style
+ * @param style the line end decoration style
*/
@SuppressWarnings("WeakerAccess")
public void setLineHeadDecoration(DecorationShape style) {
}
/**
- * Creates an XSSFPivotCacheDefintion representing the given package part and relationship.
+ * Creates an XSSFPivotCacheDefinition representing the given package part and relationship.
* Should only be called when reading in an existing file.
*
* @param part - The package part that holds xml data representing this pivot cache definition.
pivotTables.add(pivotTable);
XSSFWorkbook workbook = getWorkbook();
- //Create relationship between the pivot cache defintion and the workbook
+ //Create relationship between the pivot cache definition and the workbook
XSSFPivotCacheDefinition pivotCacheDefinition = (XSSFPivotCacheDefinition) workbook.
createRelationship(XSSFRelation.PIVOT_CACHE_DEFINITION, getWorkbook().getXssfFactory(), tableId);
String rId = workbook.getRelationId(pivotCacheDefinition);
*
* @param password the plaintext password, if null no password will be applied
* @param hashAlgo the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported.
- * if null, it will default default to sha1
+ * if null, it will default to sha1
*/
public void enforceReadonlyProtection(String password, HashAlgorithm hashAlgo) {
settings.setEnforcementEditValue(STDocProtect.READ_ONLY, password, hashAlgo);
*
* @param password the plaintext password, if null no password will be applied
* @param hashAlgo the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported.
- * if null, it will default default to sha1
+ * if null, it will default to sha1
*/
public void enforceFillingFormsProtection(String password, HashAlgorithm hashAlgo) {
settings.setEnforcementEditValue(STDocProtect.FORMS, password, hashAlgo);
*
* @param password the plaintext password, if null no password will be applied
* @param hashAlgo the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported.
- * if null, it will default default to sha1
+ * if null, it will default to sha1
*/
public void enforceCommentsProtection(String password, HashAlgorithm hashAlgo) {
settings.setEnforcementEditValue(STDocProtect.COMMENTS, password, hashAlgo);
*
* @param password the plaintext password, if null no password will be applied
* @param hashAlgo the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported.
- * if null, it will default default to sha1
+ * if null, it will default to sha1
*/
public void enforceTrackedChangesProtection(String password, HashAlgorithm hashAlgo) {
settings.setEnforcementEditValue(STDocProtect.TRACKED_CHANGES, password, hashAlgo);
* @param editValue the protection type
* @param password the plaintext password, if null no password will be applied
* @param hashAlgo the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported.
- * if null, it will default default to sha1
+ * if null, it will default to sha1
*/
public void setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue,
String password, HashAlgorithm hashAlgo) {
final XDDFValueAxis bottomAxis = chart.createValueAxis(AxisPosition.BOTTOM);
final XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT);
- // Initialize data data sources
+ // Initialize data sources
final Double dX[] = new Double[5];
final Double dY1[] = new Double[5];
shape.setRightInset(0.0);
assertEquals(0.0, shape.getRightInset(), 0);
- // unset to defauls
+ // unset to defaults
shape.setBottomInset(-1);
assertEquals(3.6, shape.getBottomInset(), 0);
shape.setTopInset(-1);
assertEquals(0, pivotTable.getRowLabelColumns().size());
pivotTable.addRowLabel(0);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(0, defintion.getRowFields().getFieldArray(0).getX());
- assertEquals(1, defintion.getRowFields().getCount());
+ assertEquals(0, definition.getRowFields().getFieldArray(0).getX());
+ assertEquals(1, definition.getRowFields().getCount());
assertEquals(1, pivotTable.getRowLabelColumns().size());
pivotTable.addRowLabel(1);
int columnIndex = 0;
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnIndex);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertNull(defintion.getColFields());
+ assertNull(definition.getColFields());
}
/**
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnOne);
pivotTable.addColumnLabel(DataConsolidateFunction.MAX, columnTwo);
pivotTable.addColumnLabel(DataConsolidateFunction.MIN, columnThree);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(3, defintion.getDataFields().getDataFieldList().size());
+ assertEquals(3, definition.getDataFields().getDataFieldList().size());
}
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnOne);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnTwo);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnThree);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(3, defintion.getDataFields().getDataFieldList().size());
+ assertEquals(3, definition.getDataFields().getDataFieldList().size());
}
/**
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnOne);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnTwo);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(defintion.getColFields().getFieldArray(0).getX(), -2);
+ assertEquals(definition.getColFields().getFieldArray(0).getX(), -2);
}
/**
void testColumnLabelCreatesDataField() {
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 0);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(0, defintion.getDataFields().getDataFieldArray(0).getFld());
+ assertEquals(0, definition.getDataFields().getDataFieldArray(0).getFld());
assertSame(STDataConsolidateFunction.Enum.forInt(DataConsolidateFunction.SUM.getValue()),
- defintion.getDataFields().getDataFieldArray(0).getSubtotal());
+ definition.getDataFields().getDataFieldArray(0).getSubtotal());
}
/**
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnIndex, customName);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(defintion.getDataFields().getDataFieldArray(0).getFld(), columnIndex);
- assertEquals(defintion.getDataFields().getDataFieldArray(0).getName(), customName);
+ assertEquals(definition.getDataFields().getDataFieldArray(0).getFld(), columnIndex);
+ assertEquals(definition.getDataFields().getDataFieldArray(0).getName(), customName);
}
/**
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnIndex, null, format);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(defintion.getDataFields().getDataFieldArray(0).getFld(), columnIndex);
- assertEquals(defintion.getDataFields().getDataFieldArray(0).getNumFmtId(), wb.createDataFormat().getFormat(format));
+ assertEquals(definition.getDataFields().getDataFieldArray(0).getFld(), columnIndex);
+ assertEquals(definition.getDataFields().getDataFieldArray(0).getNumFmtId(), wb.createDataFormat().getFormat(format));
}
/**
assertEquals(0, pivotTable.getColLabelColumns().size());
pivotTable.addColLabel(0);
- CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
+ CTPivotTableDefinition definition = pivotTable.getCTPivotTableDefinition();
- assertEquals(0, defintion.getColFields().getFieldArray(0).getX());
- assertEquals(1, defintion.getColFields().getCount());
+ assertEquals(0, definition.getColFields().getFieldArray(0).getX());
+ assertEquals(1, definition.getColFields().getCount());
assertEquals(1, pivotTable.getColLabelColumns().size());
pivotTable.addColLabel(1);
}
}
- // for the decrytped bytes
+ // for the decrypted bytes
UnsynchronizedByteArrayOutputStream bosDec = UnsynchronizedByteArrayOutputStream.builder().get();
/* decrypt excel by poi */
// Test idea: iterate over cells in the reference worksheet, they all have the R attribute set.
// For each cell from the reference sheet find the corresponding cell in the problematic file (with missing R)
// and assert that POI reads them equally:
- DataFormatter formater = new DataFormatter();
- for(Row r : sheetRef){
+ DataFormatter formatter = new DataFormatter();
+ for (Row r : sheetRef) {
XSSFRow rowRef = (XSSFRow)r;
XSSFRow row = sheet.getRow(rowRef.getRowNum());
if(!cell.getCTCell().isSetR()){
assertTrue(cellRef.getCTCell().isSetR(), "R must e set in cellRef");
- String valRef = formater.formatCellValue(cellRef);
- String val = formater.formatCellValue(cell);
+ String valRef = formatter.formatCellValue(cellRef);
+ String val = formatter.formatCellValue(cell);
assertEquals(valRef, val);
}
assertEquals(0, headerF.getParagraphs().size());
- // As an additional check, recover the defauls footer and
+ // As an additional check, recover the defaults footer and
// make sure that it contains two paragraphs of text and that
// both do hold what is expected.
footerD = policy.getDefaultFooter();
}
/**
- * protect a workbook with a password (not encypted, just sets writeprotect
+ * protect a workbook with a password (not encrypted, just sets writeprotect
* flags and the password.
*
* @param password the password
*
* @param name the name of an external function, typically a name of a UDF
* @param sheetRefIndex the sheet ref index, or -1 if not known
- * @param udf locator of user-defiend functions to resolve names of VBA and Add-In functions
+ * @param udf locator of user-defined functions to resolve names of VBA and Add-In functions
* @return the external name or null
*/
public NameXPtg getNameXPtg(String name, int sheetRefIndex, UDFFinder udf) {
}
// i've no idea.. possible values are 1 for down, 2 for up and 3 for both...0 for none..
- // maybe a diagnal line?
+ // maybe a diagonal line?
/**
* Not sure what this is for (maybe fill lines?) 1 = down, 2 = up, 3 = both, 0 for none..
}
// i've no idea.. possible values are 1 for down, 2 for up and 3 for both...0 for none..
- // maybe a diagnal line?
+ // maybe a diagonal line?
/**
* Not sure what this is for (maybe fill lines?) 1 = down, 2 = up, 3 = both, 0 for none..
}
/**
- * protect a workbook with a password (not encypted, just sets writeprotect
+ * protect a workbook with a password (not encrypted, just sets writeprotect
* flags and the password.
*
* @param password to set
}
@Test
- public final void testDefferedSetting() throws Exception {
+ public final void testDeferredSetting() throws Exception {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Name n1 = wb.createName();
assertNull(n1.getRefersToFormula());
cell.setCellValue("sometext");
assertTrue(SheetUtil.getColumnWidth(sheet, 0, true) > 0, "Having some width for rows with actual cells");
- assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any widht for rows with all empty cells");
+ assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any width for rows with all empty cells");
}
}
cell.setCellValue((String)null);
assertEquals(-1, SheetUtil.getColumnWidth(sheet, 0, true), "Having some width for rows with actual cells");
- assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any widht for rows with all empty cells");
+ assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any width for rows with all empty cells");
}
}
cell.setCellValue("");
assertTrue(SheetUtil.getColumnWidth(sheet, 0, true) > 0, "Having some width for rows with actual cells");
- assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any widht for rows with all empty cells");
+ assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any width for rows with all empty cells");
}
}
cell.setCellType(CellType.STRING);
assertTrue(SheetUtil.getColumnWidth(sheet, 0, true) > 0, "Having some width for rows with actual cells");
- assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any widht for rows with all empty cells");
+ assertEquals(-1.0, SheetUtil.getColumnWidth(sheet, 0, true, 1, 2), 0.01, "Not having any width for rows with all empty cells");
}
}
}