当前位置: 首页>>代码示例>>Java>>正文


Java Font.getStrikeout方法代码示例

本文整理汇总了Java中org.apache.poi.ss.usermodel.Font.getStrikeout方法的典型用法代码示例。如果您正苦于以下问题:Java Font.getStrikeout方法的具体用法?Java Font.getStrikeout怎么用?Java Font.getStrikeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.ss.usermodel.Font的用法示例。


在下文中一共展示了Font.getStrikeout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PoiFontDto

import org.apache.poi.ss.usermodel.Font; //导入方法依赖的package包/类
/**
 * コンストラクタ
 * @param font
 */
public PoiFontDto(Font font) {
	if (font == null) return;
	
	boldweight = StyleUtil.getBoldWeight(font.getBoldweight());
	color = StyleUtil.getColor(font.getColor());
	fontHeight = font.getFontHeight();
	fontHeightInPoints = font.getFontHeightInPoints();
	fontName = font.getFontName();
	italic = font.getItalic();
	strikeout = font.getStrikeout();
	typeOffset = StyleUtil.getFontOffset(font.getTypeOffset());
	underline = StyleUtil.getFontUnderline(font.getUnderline());
	
	this.font = font;
}
 
开发者ID:yu-ki106f,项目名称:PoiManager,代码行数:20,代码来源:PoiFontDto.java

示例2: getPoiFont

import org.apache.poi.ss.usermodel.Font; //导入方法依赖的package包/类
PoiFont getPoiFont(com.dua3.utility.text.Font font, TextAttributes attributes) {
    String name = String.valueOf(attributes.getOrDefault(TextAttributes.FONT_FAMILY, font.getFamily()));

    Object sSize = attributes.get(TextAttributes.FONT_SIZE);
    short height = (short) Math.round(sSize == null ? font.getSizeInPoints() : TextUtil.decodeFontSize(sSize.toString()));

    final Object sStyle = attributes.get(TextAttributes.FONT_STYLE);
    boolean italic = sStyle == null ? font.isItalic() : "italic".equals(sStyle);

    final Object sWeight = attributes.get(TextAttributes.FONT_WEIGHT);
    boolean bold = sWeight == null ? font.isBold() : "bold".equals(sWeight);

    Object sDecoration = attributes.get(TextAttributes.TEXT_DECORATION);
    boolean underline = sDecoration == null ? font.isUnderlined() : "underline".equals(sDecoration);
    boolean strikethrough = sDecoration == null ? font.isStrikeThrough() : "line-through".equals(sDecoration);

    Object sColor = attributes.get(TextAttributes.COLOR);
    Color color = sColor == null ? font.getColor() : Color.valueOf(sColor.toString());

    // try to find existing font
    for (short i = 0; i < poiWorkbook.getNumberOfFonts(); i++) {
        Font poiFont = poiWorkbook.getFontAt(i);

        if (poiFont.getFontName().equalsIgnoreCase(name)
                && poiFont.getFontHeightInPoints() == height
                && poiFont.getBold() == bold
                && poiFont.getItalic() == italic
                && (poiFont.getUnderline() != Font.U_NONE) == underline
                && poiFont.getStrikeout() == strikethrough
                && getColor(poiFont, Color.BLACK).equals(color)
                && poiFont.getTypeOffset() == Font.SS_NONE) {
            return new PoiFont(this, poiFont);
        }
    }

    // if not found, create it
    return createFont(font);
}
 
开发者ID:xzel23,项目名称:meja,代码行数:39,代码来源:PoiWorkbook.java

示例3: poiStyle2Netxilia

import org.apache.poi.ss.usermodel.Font; //导入方法依赖的package包/类
public static Styles poiStyle2Netxilia(CellStyle poiStyle, Font font, HSSFPalette palette,
		NetxiliaStyleResolver styleResolver) {
	List<Style> entries = new ArrayList<Style>();

	if (!poiStyle.getWrapText()) {
		entries.add(DefaultStyle.nowrap.getStyle());
	}
	// font
	if (font.getItalic()) {
		entries.add(DefaultStyle.italic.getStyle());
	}
	if (font.getStrikeout()) {
		entries.add(DefaultStyle.strikeout.getStyle());
	}
	if (font.getBoldweight() == Font.BOLDWEIGHT_BOLD) {
		entries.add(DefaultStyle.bold.getStyle());
	}
	if (font.getUnderline() != Font.U_NONE) {
		entries.add(DefaultStyle.underline.getStyle());
	}
	// borders
	if (poiStyle.getBorderBottom() != CellStyle.BORDER_NONE) {
		entries.add(DefaultStyle.borderBottom.getStyle());
	}
	if (poiStyle.getBorderLeft() != CellStyle.BORDER_NONE) {
		entries.add(DefaultStyle.borderLeft.getStyle());
	}
	if (poiStyle.getBorderTop() != CellStyle.BORDER_NONE) {
		entries.add(DefaultStyle.borderTop.getStyle());
	}
	if (poiStyle.getBorderRight() != CellStyle.BORDER_NONE) {
		entries.add(DefaultStyle.borderRight.getStyle());
	}
	// align
	switch (poiStyle.getAlignment()) {
	case CellStyle.ALIGN_LEFT:
		entries.add(DefaultStyle.alignLeft.getStyle());
		break;
	case CellStyle.ALIGN_RIGHT:
		entries.add(DefaultStyle.alignRight.getStyle());
		break;
	case CellStyle.ALIGN_CENTER:
		entries.add(DefaultStyle.alignCenter.getStyle());
		break;
	case CellStyle.ALIGN_JUSTIFY:
		entries.add(DefaultStyle.alignJustify.getStyle());
		break;
	}
	if (font != null && font.getColor() != 0) {
		HSSFColor poiForeground = palette.getColor(font.getColor());
		if (poiForeground != null && poiForeground != HSSFColor.AUTOMATIC.getInstance()) {
			Style foregroundDef = styleResolver.approximateForeground(poiForeground.getTriplet()[0],
					poiForeground.getTriplet()[1], poiForeground.getTriplet()[2]);
			if (foregroundDef != null) {
				entries.add(foregroundDef);
			}
		}
	}

	if (poiStyle.getFillForegroundColor() != 0) {
		HSSFColor poiBackground = palette.getColor(poiStyle.getFillForegroundColor());
		if (poiBackground != null && poiBackground != HSSFColor.AUTOMATIC.getInstance()) {
			Style backgroundDef = styleResolver.approximateBackground(poiBackground.getTriplet()[0],
					poiBackground.getTriplet()[1], poiBackground.getTriplet()[2]);
			if (backgroundDef != null) {
				entries.add(backgroundDef);
			}
		}
	}
	return entries.size() > 0 ? Styles.styles(entries) : null;
}
 
开发者ID:netxilia,项目名称:netxilia,代码行数:72,代码来源:PoiUtils.java

示例4: get

import org.apache.poi.ss.usermodel.Font; //导入方法依赖的package包/类
@Override
public Object get(Column column, Cell cell, Font font) {
	return font.getStrikeout();
}
 
开发者ID:hishidama,项目名称:embulk-parser-poi_excel,代码行数:5,代码来源:PoiExcelCellFontVisitor.java


注:本文中的org.apache.poi.ss.usermodel.Font.getStrikeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。