本文整理了Java中org.apache.poi.ss.usermodel.CellStyle.setIndention()
方法的一些代码示例,展示了CellStyle.setIndention()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CellStyle.setIndention()
方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.CellStyle
类名称:CellStyle
方法名:setIndention
[英]set the number of spaces to indent the text in the cell
[中]设置单元格中文本缩进的空格数
代码示例来源:origin: org.apache.poi/poi
/**
* Sets the format properties of the given style based on the given map.
*
* @param style cell style
* @param workbook parent workbook
* @param properties map of format properties (String -> Object)
* @see #getFormatProperties(CellStyle)
*/
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
style.setAlignment(getHorizontalAlignment(properties, ALIGNMENT));
style.setVerticalAlignment(getVerticalAlignment(properties, VERTICAL_ALIGNMENT));
style.setBorderBottom(getBorderStyle(properties, BORDER_BOTTOM));
style.setBorderLeft(getBorderStyle(properties, BORDER_LEFT));
style.setBorderRight(getBorderStyle(properties, BORDER_RIGHT));
style.setBorderTop(getBorderStyle(properties, BORDER_TOP));
style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
style.setDataFormat(getShort(properties, DATA_FORMAT));
style.setFillPattern(getFillPattern(properties, FILL_PATTERN));
style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
style.setFont(workbook.getFontAt(getInt(properties, FONT)));
style.setHidden(getBoolean(properties, HIDDEN));
style.setIndention(getShort(properties, INDENTION));
style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
style.setLocked(getBoolean(properties, LOCKED));
style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
style.setRotation(getShort(properties, ROTATION));
style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
style.setWrapText(getBoolean(properties, WRAP_TEXT));
}
代码示例来源:origin: Vatavuk/excel-io
@Override
public void accept(final CellStyle style) {
style.setIndention(this.value);
}
}
代码示例来源:origin: stackoverflow.com
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(CellStyle.ALIGN_LEFT);
cellStyle.setIndention((short) 2);
cell.setCellStyle(cellStyle);
代码示例来源:origin: pentaho/pentaho-reporting
@Test
public void testNullElementSttle() {
ExcelCellStyleBuilder builder = new ExcelCellStyleBuilder( workbook );
when( workbook.createCellStyle() ).thenReturn( xlsStyle );
builder.withElementStyle( null, styleKey );
verify( xlsStyle, times( 0 ) ).setAlignment( any( HorizontalAlignment.class ) );
verify( xlsStyle, times( 0 ) ).setVerticalAlignment( any( VerticalAlignment.class ) );
verify( xlsStyle, times( 0 ) ).setFont( any() );
verify( xlsStyle, times( 0 ) ).setWrapText( anyBoolean() );
verify( xlsStyle, times( 0 ) ).setIndention( anyShort() );
verify( xlsStyle, times( 0 ) ).setDataFormat( anyShort() );
}
代码示例来源:origin: pentaho/pentaho-reporting
@Test
public void testElementStyleSet() {
when( workbook.createCellStyle() ).thenReturn( xlsStyle );
ExcelCellStyleBuilder builder = new ExcelCellStyleBuilder( workbook );
when( workbook.createCellStyle() ).thenReturn( xlsStyle );
when( styleKey.getHorizontalAlignment() ).thenReturn( HorizontalAlignment.CENTER );
when( styleKey.getVerticalAlignment() ).thenReturn( VerticalAlignment.CENTER );
when( styleKey.isWrapText() ).thenReturn( true );
when( workbook.getFontAt( anyShort() ) ).thenReturn( font );
when( styleKey.getIndention() ).thenReturn( (short) 15 );
when( styleKey.getDataStyle() ).thenReturn( (short) -1 );
builder.withElementStyle( mock( StyleSheet.class ), styleKey );
verify( xlsStyle, times( 1 ) ).setAlignment( eq( HorizontalAlignment.CENTER ) );
verify( xlsStyle, times( 1 ) ).setVerticalAlignment( eq( VerticalAlignment.CENTER ) );
verify( xlsStyle, times( 1 ) ).setFont( any() );
verify( xlsStyle, times( 1 ) ).setWrapText( eq( true ) );
verify( xlsStyle, times( 1 ) ).setIndention( eq( (short) 15 ) );
verify( xlsStyle, times( 0 ) ).setDataFormat( anyShort() );
}
代码示例来源:origin: ccavanaugh/jgnash
amountStyle.setIndention((short) (model.getDepth(account) * 2));
cs.cloneStyleFrom(headerStyle);
cs.setAlignment(HorizontalAlignment.LEFT);
cs.setIndention((short) (model.getDepth(account) * 2));
代码示例来源:origin: pentaho/pentaho-reporting
public void withElementStyle( final StyleSheet elementStyleSheet, final HSSFCellStyleProducer.HSSFCellStyleKey styleKey ) {
if ( elementStyleSheet == null ) {
return;
}
hssfCellStyle.setAlignment( styleKey.getHorizontalAlignment() );
hssfCellStyle.setVerticalAlignment( styleKey.getVerticalAlignment() );
hssfCellStyle.setFont( workbook.getFontAt( styleKey.getFont() ) );
hssfCellStyle.setWrapText( styleKey.isWrapText() );
hssfCellStyle.setIndention( styleKey.getIndention() );
if ( styleKey.getDataStyle() >= 0 ) {
hssfCellStyle.setDataFormat( styleKey.getDataStyle() );
}
}
代码示例来源:origin: org.apache.poi/poi-examples
style.setIndention((short)1);
style.setWrapText(true);
styles.put("cell_indented", style);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Sets the format properties of the given style based on the given map.
*
* @param style cell style
* @param workbook parent workbook
* @param properties map of format properties (String -> Object)
* @see #getFormatProperties(CellStyle)
*/
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
style.setAlignment(getHorizontalAlignment(properties, ALIGNMENT));
style.setVerticalAlignment(getVerticalAlignment(properties, VERTICAL_ALIGNMENT));
style.setBorderBottom(getBorderStyle(properties, BORDER_BOTTOM));
style.setBorderLeft(getBorderStyle(properties, BORDER_LEFT));
style.setBorderRight(getBorderStyle(properties, BORDER_RIGHT));
style.setBorderTop(getBorderStyle(properties, BORDER_TOP));
style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
style.setDataFormat(getShort(properties, DATA_FORMAT));
style.setFillPattern(getFillPattern(properties, FILL_PATTERN));
style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
style.setFont(workbook.getFontAt(getInt(properties, FONT)));
style.setHidden(getBoolean(properties, HIDDEN));
style.setIndention(getShort(properties, INDENTION));
style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
style.setLocked(getBoolean(properties, LOCKED));
style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
style.setRotation(getShort(properties, ROTATION));
style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
style.setWrapText(getBoolean(properties, WRAP_TEXT));
}
代码示例来源:origin: com.haulmont.thirdparty/poi
/**
* Sets the format properties of the given style based on the given map.
*
* @param style cell style
* @param workbook parent workbook
* @param properties map of format properties (String -> Object)
* @see #getFormatProperties(CellStyle)
*/
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
style.setAlignment(getShort(properties, ALIGNMENT));
style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
style.setBorderLeft(getShort(properties, BORDER_LEFT));
style.setBorderRight(getShort(properties, BORDER_RIGHT));
style.setBorderTop(getShort(properties, BORDER_TOP));
style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
style.setDataFormat(getShort(properties, DATA_FORMAT));
style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
style.setFillPattern(getShort(properties, FILL_PATTERN));
style.setFont(workbook.getFontAt(getShort(properties, FONT)));
style.setHidden(getBoolean(properties, HIDDEN));
style.setIndention(getShort(properties, INDENTION));
style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
style.setLocked(getBoolean(properties, LOCKED));
style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
style.setRotation(getShort(properties, ROTATION));
style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
style.setWrapText(getBoolean(properties, WRAP_TEXT));
}
代码示例来源:origin: com.eas.platypus/platypus-js-reports
private void copyStyle(Workbook workbook, Cell fromCell, Cell toCell) {
CellStyle toStyle = toCell.getCellStyle();
CellStyle fromStyle = fromCell.getCellStyle();
CellStyle newStyle = workbook.createCellStyle();
newStyle.setAlignment(fromStyle.getAlignment());
newStyle.setBorderBottom(fromStyle.getBorderBottom());
newStyle.setBorderLeft(fromStyle.getBorderLeft());
newStyle.setBorderRight(fromStyle.getBorderRight());
newStyle.setBorderTop(fromStyle.getBorderTop());
newStyle.setBottomBorderColor(fromStyle.getBottomBorderColor());
newStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor());
newStyle.setFillForegroundColor(fromStyle.getFillForegroundColor());
newStyle.setFillPattern(fromStyle.getFillPattern());
newStyle.setFont(workbook.getFontAt(fromStyle.getFontIndex()));
newStyle.setHidden(fromStyle.getHidden());
newStyle.setIndention(fromStyle.getIndention());
newStyle.setLeftBorderColor(fromStyle.getLeftBorderColor());
newStyle.setLocked(fromStyle.getLocked());
newStyle.setRightBorderColor(fromStyle.getRightBorderColor());
newStyle.setTopBorderColor(fromStyle.getTopBorderColor());
newStyle.setVerticalAlignment(fromStyle.getVerticalAlignment());
newStyle.setWrapText(fromStyle.getWrapText());
newStyle.setDataFormat(toStyle.getDataFormat());
toCell.setCellStyle(newStyle);
}
}
代码示例来源:origin: net.sf.jxls/jxls-core
newStyle.setFont(workbook.getFontAt(style.getFontIndex()));
newStyle.setHidden(style.getHidden());
newStyle.setIndention(style.getIndention());
newStyle.setLeftBorderColor(style.getLeftBorderColor());
newStyle.setLocked(style.getLocked());
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Sets the format properties of the given style based on the given map.
*
* @param style cell style
* @param workbook parent workbook
* @param properties map of format properties (String -> Object)
* @see #getFormatProperties(CellStyle)
*/
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
style.setAlignment(getShort(properties, ALIGNMENT));
style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
style.setBorderLeft(getShort(properties, BORDER_LEFT));
style.setBorderRight(getShort(properties, BORDER_RIGHT));
style.setBorderTop(getShort(properties, BORDER_TOP));
style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
style.setDataFormat(getShort(properties, DATA_FORMAT));
style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
style.setFillPattern(getShort(properties, FILL_PATTERN));
style.setFont(workbook.getFontAt(getShort(properties, FONT)));
style.setHidden(getBoolean(properties, HIDDEN));
style.setIndention(getShort(properties, INDENTION));
style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
style.setLocked(getBoolean(properties, LOCKED));
style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
style.setRotation(getShort(properties, ROTATION));
style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
style.setWrapText(getBoolean(properties, WRAP_TEXT));
}
代码示例来源:origin: SheetJS/jxls
newStyle.setFont(workbook.getFontAt(style.getFontIndex()));
newStyle.setHidden(style.getHidden());
newStyle.setIndention(style.getIndention());
newStyle.setLeftBorderColor(style.getLeftBorderColor());
newStyle.setLocked(style.getLocked());
代码示例来源:origin: org.apache.poi/poi-contrib
/**
* Sets the format properties of the given style based on the given map.
*
* @param style cell style
* @param workbook parent workbook
* @param properties map of format properties (String -> Object)
* @see #getFormatProperties(CellStyle)
*/
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
style.setAlignment(getShort(properties, ALIGNMENT));
style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
style.setBorderLeft(getShort(properties, BORDER_LEFT));
style.setBorderRight(getShort(properties, BORDER_RIGHT));
style.setBorderTop(getShort(properties, BORDER_TOP));
style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
style.setDataFormat(getShort(properties, DATA_FORMAT));
style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
style.setFillPattern(getShort(properties, FILL_PATTERN));
style.setFont(workbook.getFontAt(getShort(properties, FONT)));
style.setHidden(getBoolean(properties, HIDDEN));
style.setIndention(getShort(properties, INDENTION));
style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
style.setLocked(getBoolean(properties, LOCKED));
style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
style.setRotation(getShort(properties, ROTATION));
style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
style.setWrapText(getBoolean(properties, WRAP_TEXT));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Sets the format properties of the given style based on the given map.
*
* @param style cell style
* @param workbook parent workbook
* @param properties map of format properties (String -> Object)
* @see #getFormatProperties(CellStyle)
*/
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
style.setAlignment(getShort(properties, ALIGNMENT));
style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
style.setBorderLeft(getShort(properties, BORDER_LEFT));
style.setBorderRight(getShort(properties, BORDER_RIGHT));
style.setBorderTop(getShort(properties, BORDER_TOP));
style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
style.setDataFormat(getShort(properties, DATA_FORMAT));
style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
style.setFillPattern(getShort(properties, FILL_PATTERN));
style.setFont(workbook.getFontAt(getShort(properties, FONT)));
style.setHidden(getBoolean(properties, HIDDEN));
style.setIndention(getShort(properties, INDENTION));
style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
style.setLocked(getBoolean(properties, LOCKED));
style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
style.setRotation(getShort(properties, ROTATION));
style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
style.setWrapText(getBoolean(properties, WRAP_TEXT));
}
代码示例来源:origin: SheetJS/jxls
private void copyStyle(Workbook workbook, org.apache.poi.ss.usermodel.Cell fromCell, org.apache.poi.ss.usermodel.Cell toCell){
CellStyle toStyle = toCell.getCellStyle();
CellStyle fromStyle = fromCell.getCellStyle();
if( fromStyle.getDataFormat() == toStyle.getDataFormat() ){
toCell.setCellStyle( fromStyle );
}else{
CellStyle newStyle = workbook.createCellStyle();
newStyle.setAlignment( toStyle.getAlignment() );
newStyle.setBorderBottom( toStyle.getBorderBottom() );
newStyle.setBorderLeft( toStyle.getBorderLeft() );
newStyle.setBorderRight( toStyle.getBorderRight() );
newStyle.setBorderTop( toStyle.getBorderTop() );
newStyle.setBottomBorderColor( toStyle.getBottomBorderColor() );
newStyle.setDataFormat( toStyle.getDataFormat() );
newStyle.setFillBackgroundColor( fromStyle.getFillBackgroundColor() );
newStyle.setFillForegroundColor( fromStyle.getFillForegroundColor() );
newStyle.setFillPattern( fromStyle.getFillPattern() );
newStyle.setFont( workbook.getFontAt( fromStyle.getFontIndex() ) );
newStyle.setHidden( toStyle.getHidden() );
newStyle.setIndention( toStyle.getIndention() );
newStyle.setLeftBorderColor( toStyle.getLeftBorderColor() );
newStyle.setLocked( toStyle.getLocked() );
newStyle.setRightBorderColor( toStyle.getRightBorderColor() );
newStyle.setTopBorderColor( toStyle.getTopBorderColor() );
newStyle.setVerticalAlignment( toStyle.getVerticalAlignment() );
newStyle.setWrapText( toStyle.getWrapText() );
toCell.setCellStyle( newStyle );
}
}
}
代码示例来源:origin: com.github.nic-luo/rober-office
toStyle.setIndention(fromStyle.getIndention());//首行缩进
toStyle.setLocked(fromStyle.getLocked());
内容来源于网络,如有侵权,请联系作者删除!