📄 shapetext.html
字号:
<DD>在指定位置删除指定长度的文本(包括图像,域,多媒体等对象)。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#delete(long, long)">delete</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offset</CODE> - 删除时光标指定的起始位置(起始位置为0)<DD><CODE>length</CODE> - 删除字符的个数 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); shapes.getShape("矩形 1").getShapeText().delete(0,5); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getFontAttribute(long)"><!-- --></A><H3>
getFontAttribute</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类">FontAttribute</A> <B>getFontAttribute</B>(long offset)</PRE>
<DL>
<DD>获得指定位置的字体属性。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#getFontAttribute(long)">getFontAttribute</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offset</CODE> - 指定位置.
<DT><B>返回:</B><DD>字体属性。 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); shapes.getShape("矩形 1").getShapeText().getFontAttribute(0); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getLength()"><!-- --></A><H3>
getLength</H3>
<PRE>
public long <B>getLength</B>()</PRE>
<DL>
<DD>返回当前区域文本的长度。
<P>
<DD><DL>
<DT><B>指定者:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#getLength()">getLength</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>返回:</B><DD>当前区域文本的长度 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); System.out.println("区域文本长度是:"+shapes.getShape("矩形 1").getShapeText().getLength()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getSelectionRange()"><!-- --></A><H3>
getSelectionRange</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/documents/document/TextRange.html" title="application.workbooks.workbook.documents.document 中的类">TextRange</A> <B>getSelectionRange</B>()</PRE>
<DL>
<DD>返回文本框编辑状态下高亮选中的一个文本区域。如果没有编辑状态下没有选中区域,则返回当前光标的位置。 如果当前文本框不没有被选择或不在编辑状态下,则返回null。
<P>
<DD><DL>
<DT><B>返回:</B><DD>返回当前选中的文本范围。 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); ShapeText shpaetext = shapes.getShape("矩形 1").getShapeText(); TextRange range = shapetext.getSelectionRange(); System.out.println("当前选中区域的文本内容是:"+range.getText()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getTables()"><!-- --></A><H3>
getTables</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/Tables.html" title="application.workbooks.workbook 中的类">Tables</A> <B>getTables</B>()</PRE>
<DL>
<DD>得到当前文本框内的表格集合。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#getTables()">getTables</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>返回:</B><DD>文本框内的表格集合 <p> <b>例子:</b> <pre> //本例首先获取当前文本框中的表格集合,并在其中插入一个子两行三列的表格(运行前先插入一文本框)。 Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); ShapeText shapeText = shapes.getShape("文本框 1").getShapeText(); Tables tables = shapeText.getTables(); TextRange textRange = shapeText.getRange(0, 0); tables.addTable(textRange, 2, 3); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getText()"><!-- --></A><H3>
getText</H3>
<PRE>
public java.lang.String <B>getText</B>()</PRE>
<DL>
<DD>得到全部的文本内容。
<P>
<DD><DL>
<DT><B>返回:</B><DD>文本内容 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); System.out.println(shapes.getShape("矩形 1").getShapeText().getText()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getTextLength()"><!-- --></A><H3>
getTextLength</H3>
<PRE>
public long <B>getTextLength</B>()</PRE>
<DL>
<DD>返回当前图形对象的文本的长度。
<P>
<DD><DL>
<DT><B>指定者:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#getTextLength()">getTextLength</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>返回:</B><DD>当前图形对象的文本的长度 <p> <b>例子:</b> <pre> //新建一电子表格,插入一矩形框,在矩形框内输入文本,本例将在控制台输出文本的长度。 Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); System.out.println(shapes.getShape("矩形 1").getShapeText().getTextLength()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="insertText(long, java.lang.String)"><!-- --></A><H3>
insertText</H3>
<PRE>
public void <B>insertText</B>(long offset,
java.lang.String text)</PRE>
<DL>
<DD>在指定位置插入带有字体属性的字符串。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#insertText(long, java.lang.String)">insertText</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offset</CODE> - 插入字符串时的位置(起始位置为0)<DD><CODE>text</CODE> - 需要插入的字符串 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); shapes.getShape("矩形 1").getShapeText().insertText(3,"insertText"); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#insertText(long, java.lang.String, application.workbooks.workbook.style.font.FontAttribute)"><CODE>AbstractText.insertText(long,String,FontAttribute)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="insertText(long, java.lang.String, application.workbooks.workbook.style.font.FontAttribute)"><!-- --></A><H3>
insertText</H3>
<PRE>
public void <B>insertText</B>(long offset,
java.lang.String text,
<A HREF="../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类">FontAttribute</A> fontAttribute)</PRE>
<DL>
<DD>在指定位置插入带有字体属性的字符串。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#insertText(long, java.lang.String, application.workbooks.workbook.style.font.FontAttribute)">insertText</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offset</CODE> - 插入字符串时的位置(起始位置为0)<DD><CODE>string</CODE> - 需要插入的字符串<DD><CODE>fontAttribute</CODE> - 插入字符串的字体属性 <p> <b>例子:</b> <pre> Shapes shapes = Application.getWorkbooks().getActiveWorkbook().getActiveShapes(); FontAttribute font = new FontAttribute(); font.setBold(true); shapes.getShape("矩形 1").getShapeText().insertText(0,"Test",font); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#insertText(long, java.lang.String)"><CODE>AbstractText.insertText(long,String)</CODE></A>,
<A HREF="../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类"><CODE>FontAttribute</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="insertText(java.lang.String)"><!-- --></A><H3>
insertText</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -