// with a special style or format
int styleIndex = Integer.parseInt(cellStyleStr);
XSSFCellStyle style = stylesTable.getStyleAt(styleIndex);
- if (style == null && stylesTable.getNumCellStyles() > 0) {
- style = stylesTable.getStyleAt(0);
- }
- if (style != null) {
- this.formatIndex = style.getDataFormat();
- this.formatString = style.getDataFormatString();
- if (this.formatString == null) {
- this.formatString = BuiltinFormats.getBuiltinFormat(this.formatIndex);
- }
+ this.formatIndex = style.getDataFormat();
+ this.formatString = style.getDataFormatString();
+ if (this.formatString == null) {
+ this.formatString = BuiltinFormats.getBuiltinFormat(this.formatIndex);
}
}
}
public String getPIDString(final long pid)
{
String s = null;
- if (dictionary != null)
+ if (dictionary != null) {
s = dictionary.get(Long.valueOf(pid));
- if (s == null)
+ }
+ if (s == null) {
s = SectionIDMap.getPIDString(getFormatID().getBytes(), pid);
- if (s == null)
- s = SectionIDMap.UNDEFINED;
+ }
return s;
}
}
break;
case HSSFCell.CELL_TYPE_NUMERIC:
- HSSFCellStyle style = cell.getCellStyle();
- if(style == null) {
- text.append( cell.getNumericCellValue() );
- } else {
- text.append(
- _formatter.formatRawCellContents(
- cell.getNumericCellValue(),
- style.getDataFormat(),
- style.getDataFormatString()
- )
- );
- }
+ HSSFCellStyle style = cell.getCellStyle();
+ double nVal = cell.getNumericCellValue();
+ short df = style.getDataFormat();
+ String dfs = style.getDataFormatString();
+ text.append(_formatter.formatRawCellContents(nVal, df, dfs));
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
text.append(cell.getBooleanCellValue());
*/
public String getFileName() {
String name = getPackagePart().getPartName().getName();
- if (name == null) {
- return null;
- }
return name.substring(name.lastIndexOf('/') + 1);
}
*/
@Override
public String getStringCellValue() {
- XSSFRichTextString str = getRichStringCellValue();
- return str == null ? null : str.getString();
+ return getRichStringCellValue().getString();
}
/**
*/
public String getFileName() {
String name = getPackagePart().getPartName().getName();
- if (name == null) {
- return null;
- }
return name.substring(name.lastIndexOf('/') + 1);
}
\r
break;
case HSSFCell.CELL_TYPE_NUMERIC:
HSSFCellStyle style = cell.getCellStyle();
- if ( style == null )
- {
- return false;
- }
-
- value = ( _formatter.formatRawCellContents(
- cell.getNumericCellValue(), style.getDataFormat(),
- style.getDataFormatString() ) );
+ double nval = cell.getNumericCellValue();
+ short df = style.getDataFormat();
+ String dfs = style.getDataFormatString();
+ value = _formatter.formatRawCellContents(nval, df, dfs);
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
value = String.valueOf( cell.getBooleanCellValue() );
break;
case HSSFCell.CELL_TYPE_NUMERIC:
double nValue = cell.getNumericCellValue();
- if ( cellStyle == null ) {
- value = Double.toString( nValue );
- } else {
- short df = cellStyle.getDataFormat();
- String dfs = cellStyle.getDataFormatString();
- value = _formatter.formatRawCellContents(nValue, df, dfs );
- }
+ short df = cellStyle.getDataFormat();
+ String dfs = cellStyle.getDataFormatString();
+ value = _formatter.formatRawCellContents(nValue, df, dfs );
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
value = Boolean.toString( cell.getBooleanCellValue() );
}
final boolean noText = ExcelToHtmlUtils.isEmpty( value );
- final boolean wrapInDivs = !noText && (cellStyle == null || !cellStyle.getWrapText());
+ final boolean wrapInDivs = !noText && !cellStyle.getWrapText();
final boolean emptyStyle = isEmptyStyle( cellStyle );
if ( !emptyStyle && noText ) {
break;
case HSSFCell.CELL_TYPE_NUMERIC:
double nValue = cell.getNumericCellValue();
- if ( cellStyle == null ) {
- value = Double.toString(nValue);
- } else {
- short df = cellStyle.getDataFormat();
- String dfs = cellStyle.getDataFormatString();
- value = _formatter.formatRawCellContents(nValue, df, dfs);
- }
+ short df = cellStyle.getDataFormat();
+ String dfs = cellStyle.getDataFormatString();
+ value = _formatter.formatRawCellContents(nValue, df, dfs);
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
value = String.valueOf( cell.getBooleanCellValue() );
}
final boolean noText = ExcelToHtmlUtils.isEmpty( value );
- final boolean wrapInDivs = !noText && isUseDivsToSpan()
- && (cellStyle == null || !cellStyle.getWrapText());
+ final boolean wrapInDivs = !noText && isUseDivsToSpan() && !cellStyle.getWrapText();
- if ( cellStyle != null && cellStyle.getIndex() != 0 )
+ if ( cellStyle.getIndex() != 0 )
{
@SuppressWarnings("resource")
HSSFWorkbook workbook = cell.getRow().getSheet().getWorkbook();
innerDivStyle.append( "overflow:hidden;max-height:" );
innerDivStyle.append( normalHeightPt );
innerDivStyle.append( "pt;white-space:nowrap;" );
- if (cellStyle != null) {
- ExcelToHtmlUtils.appendAlign( innerDivStyle, cellStyle.getAlignment() );
- }
+ ExcelToHtmlUtils.appendAlign( innerDivStyle, cellStyle.getAlignment() );
htmlDocumentFacade.addStyleClass( outerDiv, cssClassPrefixDiv,
innerDivStyle.toString() );
tableCellElement.appendChild( text );
}
- return ExcelToHtmlUtils.isEmpty( value ) && (cellStyle == null || cellStyle.getIndex() == 0);
+ return ExcelToHtmlUtils.isEmpty( value ) && (cellStyle.getIndex() == 0);
}
protected void processColumnHeaders( HSSFSheet sheet, int maxSheetColumns,