📄 fontattribute.html
字号:
BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setEmboss(true); baseText.setFontAttribute(10,18,font); System.out.println("字体是否设置为阳文:"+font.getEmboss()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setEmboss(boolean)"><CODE>setEmboss(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getEngrave()"><!-- --></A><H3>
getEngrave</H3>
<PRE>
public int <B>getEngrave</B>()</PRE>
<DL>
<DD>判断字体是否设置了阴文效果。
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果设置字体阴文效果,则返回1;否则,返回0;如果返回值为9999999表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setEngrave(true); baseText.setFontAttribute(10,18,font); System.out.println("字体是否设置为阴文:"+font.getEngrave()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setEngrave(boolean)"><CODE>setEngrave(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getFontFamily()"><!-- --></A><H3>
getFontFamily</H3>
<PRE>
public java.lang.String <B>getFontFamily</B>()</PRE>
<DL>
<DD>获得英文字体。
<P>
<DD><DL>
<DT><B>返回:</B><DD>返回英文字体名称,如果返回值为null,则表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setFontFamily("Roman"); baseText.setFontAttribute(10,18,font); String fontName = font.getFontFamily(); System.out.println("得到原来设置的英文字体名称为: " + fontName); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setFontFamily(java.lang.String)"><CODE>setFontFamily(String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getFontShadow()"><!-- --></A><H3>
getFontShadow</H3>
<PRE>
public int <B>getFontShadow</B>()</PRE>
<DL>
<DD>判断字体是否设置了阴影效果。
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果设置了字体阴影效果,则返回1;否则,返回0;如果返回值为9999999表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setFontShadow(true); baseText.setFontAttribute(10,18,font); System.out.println("字体是否设置为阴影:"+font.getFontShadow()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setFontShadow(boolean)"><CODE>setFontShadow(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getFontSize()"><!-- --></A><H3>
getFontSize</H3>
<PRE>
public double <B>getFontSize</B>()</PRE>
<DL>
<DD>获得字体大小。
<P>
<DD><DL>
<DT><B>返回:</B><DD>字体的大小,如果返回值为9999999,则表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setFontSize(24); baseText.setFontAttribute(10,18,font); System.out.println("得到当前字体大小为:" + font.getFontSize()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setFontSize(int)"><CODE>setFontSize(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getFontStyle()"><!-- --></A><H3>
getFontStyle</H3>
<PRE>
public int <B>getFontStyle</B>()</PRE>
<DL>
<DD>返回字体类型。
<P>
<DD><DL>
<DT><B>返回:</B><DD>style 字体类型,使用java.awt.Font类中常量。如果返回值为9999999,则表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setFontStyle(java.awt.Font.BOLD); baseText.setFontAttribute(10,18,font); System.out.println("字体类型:"+font.getFontStyle()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getForeground()"><!-- --></A><H3>
getForeground</H3>
<PRE>
public java.awt.Color <B>getForeground</B>()</PRE>
<DL>
<DD>获得字体前景色。
<P>
<DD><DL>
<DT><B>返回:</B><DD>Color,即字体的前景色,如果返回值为null,则表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); java.awt.Color color = new java.awt.Color(255,24,0); font.setForeground(color); baseText.setFontAttribute(10,18,font); System.out.println("得到字体前景色RGB表示中的R:" + font.getForeground().getRed()); System.out.println("得到字体前景色RGB表示中的G:" + font.getForeground().getGreen()); System.out.println("得到字体前景色RGB表示中的B:" + font.getForeground().getBlue()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setForeground(int, int, int)"><CODE>setForeground(int,int,int)</CODE></A>,
<A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setForeground(java.awt.Color)"><CODE>setForeground(java.awt.Color)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getHidden()"><!-- --></A><H3>
getHidden</H3>
<PRE>
public int <B>getHidden</B>()</PRE>
<DL>
<DD>得到字体是否设置为隐藏文字。(注:仅文字处理有效)
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果设置字体隐藏文字,返回1;否则,返回0;如果返回值为9999999表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setHidden(true); baseText.setFontAttribute(10,18,font); System.out.println("字体是否设置为隐藏文字:"+font.getHidden()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setHidden(boolean)"><CODE>setHidden(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getItalic()"><!-- --></A><H3>
getItalic</H3>
<PRE>
public int <B>getItalic</B>()</PRE>
<DL>
<DD>得到字体是否设置为斜体。
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果字体斜体,则返回1;否则,返回0;如果返回值为9999999,则表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setItalic(true); baseText.setFontAttribute(10,18,font); System.out.println("字体是否设置斜体:"+font.getItalic()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setItalic(boolean)"><CODE>setItalic(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getKerning()"><!-- --></A><H3>
getKerning</H3>
<PRE>
public float <B>getKerning</B>()</PRE>
<DL>
<DD>得到调整字体字符间距
<P>
<DD><DL>
<DT><B>返回:</B><DD>调整字体字符间距,取值范围为1 ~ 1638磅。如果返回值为9999999表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setKerning(3.0f); baseText.setFontAttribute(10,18,font); System.out.println("调整字体字符间距:" + font.getKerning()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setKerning(float)"><CODE>setKerning(float)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getOutline()"><!-- --></A><H3>
getOutline</H3>
<PRE>
public int <B>getOutline</B>()</PRE>
<DL>
<DD>判断字体是否设置为空心。
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果设置字体空心,返回1;否则,返回0;如果返回值为9999999表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setOutine(false); baseText.setFontAttribute(10,18,font); System.out.println("字体是否设置为空心:"+font.getOutline()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html#setOutline(boolean)"><CODE>setOutline(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getSmallCaps()"><!-- --></A><H3>
getSmallCaps</H3>
<PRE>
public int <B>getSmallCaps</B>()</PRE>
<DL>
<DD>判断字体是否全部小写。(注:仅文字处理和幻灯片演示有效)
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果设置字体为全部小写,返回1;否则,返回0;如果返回值为9999999表示当前字体属性为三态 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\n"); FontAttribute font = new FontAttribute(); font.setSmallCaps(true); baseText.setFontAttribute(10,18,font); System.out.println("字体是否全部小写:"+font.getSmallCaps()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../applic
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -