本文整理匯總了Java中org.apache.poi.ss.usermodel.Font.setTypeOffset方法的典型用法代碼示例。如果您正苦於以下問題:Java Font.setTypeOffset方法的具體用法?Java Font.setTypeOffset怎麽用?Java Font.setTypeOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.poi.ss.usermodel.Font
的用法示例。
在下文中一共展示了Font.setTypeOffset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyFont
import org.apache.poi.ss.usermodel.Font; //導入方法依賴的package包/類
/**
* 複製字體
*
* @author ZhengWei(HY)
* @createDate 2017-03-18
* @version v1.0
*
* @param i_FromFont 源字體
* @param i_ToFont 目標字體
*/
public final static void copyFont(Font i_FromFont ,Font i_ToFont)
{
i_ToFont.setBold( i_FromFont.getBold());
i_ToFont.setCharSet( i_FromFont.getCharSet());
i_ToFont.setColor( i_FromFont.getColor());
i_ToFont.setFontHeight( i_FromFont.getFontHeight());
i_ToFont.setFontHeightInPoints(i_FromFont.getFontHeightInPoints());
i_ToFont.setFontName( i_FromFont.getFontName());
i_ToFont.setItalic( i_FromFont.getItalic());
i_ToFont.setStrikeout( i_FromFont.getStrikeout());
i_ToFont.setTypeOffset( i_FromFont.getTypeOffset());
i_ToFont.setUnderline( i_FromFont.getUnderline());
}
示例2: createFont
import org.apache.poi.ss.usermodel.Font; //導入方法依賴的package包/類
/**
* Creates a new <code>Font</code> for the given <code>Workbook</code>,
* with the given attributes. Moved from <code>StyleTag</code> here for
* 0.5.0.
* @param workbook A <code>Workbook</code>.
* @param fontBoldweight A <code>short</code> boldweight constant.
* @param fontItalic Whether the text is italic.
* @param fontColor A color <code>Color</code> opbject.
* @param fontName A font name.
* @param fontHeightInPoints A <code>short</code> font height in points.
* @param fontUnderline A <code>byte</code> underline constant.
* @param fontStrikeout Whether the font is strikeout.
* @param fontCharset An <code>int</code> charset constant.
* @param fontTypeOffset A <code>short</code> type offset constant.
* @return A new <code>Font</code>.
*/
public static Font createFont(Workbook workbook, short fontBoldweight, boolean fontItalic, Color fontColor, String fontName, short fontHeightInPoints, byte fontUnderline,
boolean fontStrikeout, int fontCharset, short fontTypeOffset)
{
if (DEBUG)
{
System.err.println("createFont: " + fontBoldweight + "," + fontItalic + "," +
((fontColor == null) ? "null" :fontColor.toString()
// (fontColor instanceof HSSFColor) ? fontColor.toString() :
// ((XSSFColor) fontColor).getCTColor().toString()
) + "," + fontName + "," +
fontHeightInPoints + "," + fontUnderline + "," + fontStrikeout + "," + fontCharset + "," + fontTypeOffset);
}
Font f = workbook.createFont();
f.setBoldweight(fontBoldweight);
f.setItalic(fontItalic);
f.setFontName(fontName);
f.setFontHeightInPoints(fontHeightInPoints);
f.setUnderline(fontUnderline);
f.setStrikeout(fontStrikeout);
f.setCharSet(fontCharset);
f.setTypeOffset(fontTypeOffset);
// Color type check.
if (fontColor instanceof HSSFColor)
{
f.setColor(((HSSFColor) fontColor).getIndex());
}
return f;
}
示例3: createFont
import org.apache.poi.ss.usermodel.Font; //導入方法依賴的package包/類
private static short createFont(Workbook workbook, FontKey key) {
Font ret = workbook.createFont();
if (key.getBoldweight() != null) {
ret.setBoldweight(key.getBoldweight().shortValue());
}
if (key.getCharset() != null) {
ret.setCharSet(key.getCharset().shortValue());
}
if (key.getColor() != null) {
ret.setColor(key.getColor().shortValue());
}
if (key.getFontHeight() != null) {
ret.setFontHeight(key.getFontHeight().shortValue());
}
if (key.getFontHeightInPoints() != null) {
ret.setFontHeightInPoints(key.getFontHeightInPoints().shortValue());
}
if (key.getFontName() != null) {
ret.setFontName(key.getFontName());
}
if (key.getItalic() != null) {
ret.setItalic(key.getItalic().booleanValue());
}
if (key.getStrikeout() != null) {
ret.setStrikeout(key.getStrikeout().booleanValue());
}
if (key.getTypeOffset() != null) {
ret.setTypeOffset(key.getTypeOffset().shortValue());
}
if (key.getUnderLine() != null) {
ret.setUnderline(key.getUnderLine().byteValue());
}
return ret.getIndex();
}
示例4: update
import org.apache.poi.ss.usermodel.Font; //導入方法依賴的package包/類
/**
* 更新
* @param font
*/
public void update(Font font) {
if (boldweight != null) {
font.setBoldweight(boldweight.value());
}
if (color != null) {
font.setColor(color.value());
}
if (fontHeight != null) {
font.setFontHeight(fontHeight);
}
if (fontHeightInPoints != null) {
font.setFontHeightInPoints(fontHeightInPoints);
}
if (fontName != null) {
font.setFontName(fontName);
font.setCharSet(Font.DEFAULT_CHARSET);
}
if (italic != null) {
font.setItalic(italic);
}
if (strikeout != null) {
font.setStrikeout(strikeout);
}
if (typeOffset != null) {
font.setTypeOffset(typeOffset.value());
}
if (underline != null) {
font.setUnderline(underline.value());
}
}