TableAbsorber

遗产: java.lang.Object

public class TableAbsorber

表示表格元素的吸收器对象。通过 TableAbsorber.TableList 集合执行搜索并提供对搜索结果的访问。


The example demonstrates how to find table on the first PDF document page and replace the text in a table cell.

 	//打开文档
 Document doc = new Document("D:\\Tests\\input.pdf");
 //创建 TableAbsorber 对象以查找表
 TableAbsorber absorber = new TableAbsorber();
 //使用吸收器访问第一页
 absorber.visit(doc.getPages().get_Item(1));
 //访问页面上的第一个表格、第一个单元格和其中的文本片段
 TextFragment fragment = absorber.getTableList().get_Item(0).getRowList().get_Item(0).getCellList().get_Item(0)
 .getTextFragments().get_Item(1);
 //更改单元格中第一个文本片段的文本
 fragment.setText("hi world");
 //保存文件
 doc.save("D:\\Tests\\output.pdf");

构造函数

构造函数描述
TableAbsorber(TextSearchOptions textSearchOptions)使用文本搜索选项初始化 TableAbsorber 的新实例。
TableAbsorber()初始化 TableAbsorber 的新实例。

方法

方法描述
equals(Object arg0)
getClass()
getTableList()返回包含找到的表的只读 IList
getTextSearchOptions()获取文本搜索选项。
hashCode()
isUseFlowEngine()激活可用于无边框转换表的替代表识别引擎的早期 alfa 版本。
notify()
notifyAll()
remove(AbsorbedTable table)从页面中删除 AbsorbedTable。
replace(Page page, AbsorbedTable oldTable, Table newTable)用页面上的表替换 AbsorbedTable。
setTextSearchOptions(TextSearchOptions value)获取或设置文本搜索选项。
setUseFlowEngine(boolean useFlowEngine)激活可用于无边框转换表的替代表识别引擎的早期 alfa 版本。
toString()
visit(Page page)提取指定页面上的表格
wait()
wait(long arg0)
wait(long arg0, int arg1)

TableAbsorber(TextSearchOptions textSearchOptions)

public TableAbsorber(TextSearchOptions textSearchOptions)

使用文本搜索选项初始化 TableAbsorber 的新实例。

参数:

范围类型描述
textSearchOptionsTextSearchOptions文本搜索选项

执行表搜索并通过 TableList 对象提供对表的访问。|

TableAbsorber()

public TableAbsorber()

初始化 TableAbsorber 的新实例。


执行表搜索并通过 TableList 对象提供对表的访问。

equals(Object arg0)

public boolean equals(Object arg0)

参数:

范围类型描述
arg0java.lang.Object

退货: 布尔值

getClass()

public final native Class<?> getClass()

退货: java.lang.Class

getTableList()

public List<AbsorbedTable> getTableList()

返回包含找到的表的只读 IList

退货: java.util.List<com.aspose.pdf.AbsorbedTable> - IGenericList 对象

getTextSearchOptions()

public TextSearchOptions getTextSearchOptions()

获取文本搜索选项。


允许定义几个选项,这些选项将在搜索包含在表格中的文本时使用。

退货: TextSearchOptions - TextSearchOptions 对象

hashCode()

public native int hashCode()

退货: 整数

isUseFlowEngine()

public boolean isUseFlowEngine()

激活可用于无边框转换表的替代表识别引擎的早期 alfa 版本。尚不支持编辑表格和获取文本样式。默认情况下是假的。

退货: boolean - 布尔值

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

remove(AbsorbedTable table)

public void remove(AbsorbedTable table)

从页面中删除 AbsorbedTable。


请考虑它更改 TableList 集合。如果在循环中删除/替换表,请使用 TableList 集合的副本。

参数:

范围类型描述
tableAbsorbedTable要删除的 AbsorbedTable。

replace(Page page, AbsorbedTable oldTable, Table newTable)

public void replace(Page page, AbsorbedTable oldTable, Table newTable)

用页面上的表替换 AbsorbedTable。


请考虑它更改 TableList 集合。如果在循环中删除/替换表,请使用 TableList 集合的副本。

参数:

范围类型描述
pagePagePdf 文档页面对象。
oldTableAbsorbedTable要替换的 AbsorbedTable。
newTableTable替换旧表的表。

setTextSearchOptions(TextSearchOptions value)

public void setTextSearchOptions(TextSearchOptions value)

获取或设置文本搜索选项。


允许定义几个选项,这些选项将在搜索包含在表格中的文本时使用。

参数:

范围类型描述
valueTextSearchOptionsTextSearchOptions 对象

setUseFlowEngine(boolean useFlowEngine)

public void setUseFlowEngine(boolean useFlowEngine)

激活可用于无边框转换表的替代表识别引擎的早期 alfa 版本。尚不支持编辑表格和获取文本样式。默认情况下是假的。

参数:

范围类型描述
useFlowEngineboolean布尔值

toString()

public String toString()

退货: java.lang.字符串

visit(Page page)

public void visit(Page page)

提取指定页面上的表格


The example demonstrates how to extract table on the first PDF document page.

 //打开文档
 Document doc = new Document(@"D:\Tests\input.pdf");
 //创建 TableAbsorber 对象以查找表
 TableAbsorber absorber = new TableAbsorber();
 //使用吸收器访问第一页
 absorber.visit(pdfDocument.getPages.get_item(1));
 //访问页面上的第一个表格、第一个单元格和其中的文本片段
 TextFragment fragment = absorber.getTableList().get_item(0).getRowList.get_item(0).getCellList().get_item(0)
 .getTextFragments.get_item(1);
 //更改单元格中第一个文本片段的文本
 fragment.setText ("hi world");
 //保存文件
 doc.save(@"D:\Tests\output.pdf");

参数:

范围类型描述
pagePagePdf 文档页面对象。

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

参数:

范围类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

参数:

范围类型描述
arg0long
arg1int