给表格插入了题注,使用以下代码无法获取到
String docPath = "C:\\Users\\修改记录.docx";
Document document = new Document(docPath);
Table table = (Table) document.getChild(NodeType.TABLE,0, true);
String tableTitle = table.getTitle();
给表格插入了题注,使用以下代码无法获取到
String docPath = "C:\\Users\\修改记录.docx";
Document document = new Document(docPath);
Table table = (Table) document.getChild(NodeType.TABLE,0, true);
String tableTitle = table.getTitle();
@ouchli Table.Title
property provides access an alternative text representation of the information contained in the table. The content you have outlined is a paragraph before the table, not table title. You can get it using the following code:
Table table = (Table) document.getChild(NodeType.TABLE,0, true);
Paragraph prevParagraph = (Paragraph)table.getPreviousSibling();
你好,使用上一个节点获取的题注有些乱码,与预期不符合
预期为:表1 你好世界
实际为:表 SEQ 表 * ARABIC 1 你好世界
@ouchli 使用以下代码获取段落文本:
Table table = (Table) document.getChild(NodeType.TABLE,0, true);
Paragraph prevParagraph = (Paragraph)table.getPreviousSibling();
String prevParagraphText = prevParagraph.toString(SaveFormat.TEXT).trim();