📄 cellattribute.html
字号:
</TR>
</TABLE>
<A NAME="getBottomMargin()"><!-- --></A><H3>
getBottomMargin</H3>
<PRE>
public float <B>getBottomMargin</B>()</PRE>
<DL>
<DD>得到当前单元格下边距。说明:边距的范围为0~1584磅。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格下边距(单位为磅值) <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("单元格下边距为:" + cellAttribute.getBottomMargin()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setBottomMargin(float)"><CODE>setBottomMargin(float)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getLeftMargin()"><!-- --></A><H3>
getLeftMargin</H3>
<PRE>
public float <B>getLeftMargin</B>()</PRE>
<DL>
<DD>得到当前单元格左边距。说明:边距的范围为0~1584磅。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格左边距(单位为磅值) <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("单元格左边距为:" + cellAttribute.getLeftMargin()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setLeftMargin(float)"><CODE>setLeftMargin(float)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getPreferredWidth()"><!-- --></A><H3>
getPreferredWidth</H3>
<PRE>
public float <B>getPreferredWidth</B>()</PRE>
<DL>
<DD>得到指定单元格的宽度。
<P>
<DD><DL>
<DT><B>返回:</B><DD>返回单元格的宽度 说明:单元格宽度的度量类型不同,单元格宽度值的语义也不一样。如果,度量类型为固定值,则返回单元格宽度为磅值,范围在0~1584磅; 如果度量类型为百分比,则返回单元格宽度是一个相对值,范围在0~100%。 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("返回指定单元格的宽度为:" + cellAttribute.getPreferredWidth()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setPreferredWidth(float)"><CODE>setPreferredWidth(float)</CODE></A>,
<A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#getPreferredWidthMeasure()"><CODE>getPreferredWidthMeasure()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getPreferredWidthMeasure()"><!-- --></A><H3>
getPreferredWidthMeasure</H3>
<PRE>
public int <B>getPreferredWidthMeasure</B>()</PRE>
<DL>
<DD>得到指定单元格宽度的度量方式。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格宽度的度量方式,只能取一下值之一: <pre> TableConstants.CELL_WIDTH_NONE_SET 不指定单元格宽度 TableConstants.CELL_WIDTH_MEASURE 指定宽度为绝对值 TableConstants.CELL_WIDTH_PRECENT 指定宽度为百分比 </pre> <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("返回指定单元格宽度的度量方式为:" + cellAttribute.getPreferredWidthMeasure()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#getPreferredWidth()"><CODE>getPreferredWidth()</CODE></A>,
<A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setPreferredWidthMeasure(int)"><CODE>setPreferredWidthMeasure(int)</CODE></A>,
<A HREF="../../../../application/constants/TableConstants.html" title="application.constants 中的接口"><CODE>TableConstants</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getRightMargin()"><!-- --></A><H3>
getRightMargin</H3>
<PRE>
public float <B>getRightMargin</B>()</PRE>
<DL>
<DD>得到当前单元格右边距。说明:边距的范围为0~1584磅。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格右边距(单位为磅值) <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("单元格右边距为:" + cellAttribute.getRightMargin()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setRightMargin(float)"><CODE>setRightMargin(float)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getTopMargin()"><!-- --></A><H3>
getTopMargin</H3>
<PRE>
public float <B>getTopMargin</B>()</PRE>
<DL>
<DD>得到当前单元格上边距。说明:边距的范围为0~1584磅。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格上边距(单位为磅值) <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("单元格上边距为:" + cellAttribute.getTopMargin()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setTopMargin(float)"><CODE>setTopMargin(float)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getVerticalAlignment()"><!-- --></A><H3>
getVerticalAlignment</H3>
<PRE>
public int <B>getVerticalAlignment</B>()</PRE>
<DL>
<DD>获得单元格的垂直对齐方式。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格的垂直对齐方式,只能取以下整形值之一: <pre> TableConstants.V_TOP = 0 顶端对齐 TableConstants.V_CENTER = 1 居中对齐 TableConstants.V_BOTTOM = 2 底端对齐 </pre> <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("单元格的竖直排列方式为:" + cellAttribute.getVerticalAlignment()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setVerticalAlignment(int)"><CODE>setVerticalAlignment(int)</CODE></A>,
<A HREF="../../../../application/constants/TableConstants.html" title="application.constants 中的接口"><CODE>TableConstants</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isCellMarginSameAsTable()"><!-- --></A><H3>
isCellMarginSameAsTable</H3>
<PRE>
public boolean <B>isCellMarginSameAsTable</B>()</PRE>
<DL>
<DD>判断当前单元格边距是否取自整张表格的默认单元格边距。
<P>
<DD><DL>
<DT><B>返回:</B><DD>布尔值型,单元格各边距是否与整张表格的默认单元格各边距相同。 如果为true,则取自默认边距,否则,取自实际边距 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("判断当前单元格边距是否取自整张表格的默认单元格边距:" + cellAttribute.isCellMarginSameAsTable()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setCellMarginSameAsTable(boolean)"><CODE>setCellMarginSameAsTable(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isWordWrap()"><!-- --></A><H3>
isWordWrap</H3>
<PRE>
public boolean <B>isWordWrap</B>()</PRE>
<DL>
<DD>判断当前单元格是否可以自动换行。
<P>
<DD><DL>
<DT><B>返回:</B><DD>如果为true,则可以自动换行 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); System.out.println("表格单元格是否自动换行:" + cellAttribute.isWordWrap()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html#setWordWrap(boolean)"><CODE>setWordWrap(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setBottomMargin(float)"><!-- --></A><H3>
setBottomMargin</H3>
<PRE>
public void <B>setBottomMargin</B>(float margin)</PRE>
<DL>
<DD>设置当前单元格下边距。说明:边距的范围为0~1584磅。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>margin</CODE> - 单元格下边距(单位为磅值) <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); cellAttribute.setCellMarginSameAsTable(false); cellAttribute.setBottomMargin(30.0f); cell.setCellAttribute(cellAttribute); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="setCellMarginSameAsTable(boolean)"><!-- --></A><H3>
setCellMarginSameAsTable</H3>
<PRE>
public void <B>setCellMarginSameAsTable</B>(boolean sameAsTable)</PRE>
<DL>
<DD>设置当前单元格边距是否取自整张表格的默认单元格边距。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>sameAsTable</CODE> - 布尔值型,单元格各边距是否与整张表格的默认单元格各边距相同。 如果为true,则取自默认边距,否则,取自实际边距 <p> <b>例子:</b> <pre>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -