/** * Returns the textual content of the header/footer, * by flattening out the text of its paragraph(s) */ public String getText() { StringBuilder t = new StringBuilder(64); //TODO: simplify this to get ibody elements in order for (int i = 0; i < paragraphs.size(); i++) { if (!paragraphs.get(i).isEmpty()) { String text = paragraphs.get(i).getText(); if (text != null && text.length() > 0) { t.append(text); t.append('\n'); } } } for (int i = 0; i < tables.size(); i++) { String text = tables.get(i).getText(); if (text != null && text.length() > 0) { t.append(text); t.append('\n'); } } for (IBodyElement bodyElement : getBodyElements()) { if (bodyElement instanceof XWPFSDT) { t.append(((XWPFSDT) bodyElement).getContent().getText() + '\n'); } } return t.toString(); }
/** * Returns the textual content of the header/footer, * by flattening out the text of its paragraph(s) */ public String getText() { StringBuffer t = new StringBuffer(); for(int i=0; i<paragraphs.size(); i++) { if(! paragraphs.get(i).isEmpty()) { String text = paragraphs.get(i).getText(); if(text != null && text.length() > 0) { t.append(text); t.append('\n'); } } } List<XWPFTable> tables = getTables(); for(int i=0; i<tables.size(); i++) { String text = tables.get(i).getText(); if(text != null && text.length() > 0) { t.append(text); t.append('\n'); } } return t.toString(); }
/** * Returns the textual content of the header/footer, * by flattening out the text of its paragraph(s) */ public String getText() { StringBuilder t = new StringBuilder(64); //TODO: simplify this to get ibody elements in order for (int i = 0; i < paragraphs.size(); i++) { if (!paragraphs.get(i).isEmpty()) { String text = paragraphs.get(i).getText(); if (text != null && text.length() > 0) { t.append(text); t.append('\n'); } } } for (int i = 0; i < tables.size(); i++) { String text = tables.get(i).getText(); if (text != null && text.length() > 0) { t.append(text); t.append('\n'); } } for (IBodyElement bodyElement : getBodyElements()) { if (bodyElement instanceof XWPFSDT) { t.append(((XWPFSDT) bodyElement).getContent().getText() + '\n'); } } return t.toString(); }
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception { // 第一步解析文档 parseAllParagraphic(doc.getParagraphs(), map); // 第二步解析页眉,页脚 parseHeaderAndFoot(doc, map); // 第三步解析所有表格 XWPFTable table; Iterator<XWPFTable> itTable = doc.getTablesIterator(); while (itTable.hasNext()) { table = itTable.next(); if (table.getText().indexOf(START_STR) != -1) { parseThisTable(table, map); } } }
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception { // 第一步解析文档 parseAllParagraphic(doc.getParagraphs(), map); // 第二步解析页眉,页脚 parseHeaderAndFoot(doc, map); // 第三步解析所有表格 XWPFTable table; Iterator<XWPFTable> itTable = doc.getTablesIterator(); while (itTable.hasNext()) { table = itTable.next(); if (table.getText().indexOf("{{") != -1) { parseThisTable(table, map); } } }
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception { // 第一步解析文档 parseAllParagraphic(doc.getParagraphs(), map); // 第二步解析页眉,页脚 parseHeaderAndFoot(doc, map); // 第三步解析所有表格 XWPFTable table; Iterator<XWPFTable> itTable = doc.getTablesIterator(); while (itTable.hasNext()) { table = itTable.next(); if (table.getText().indexOf("{{") != -1) { parseThisTable(table, map); } } }
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception { // 第一步解析文档 parseAllParagraphic(doc.getParagraphs(), map); // 第二步解析页眉,页脚 parseHeaderAndFoot(doc, map); // 第三步解析所有表格 XWPFTable table; Iterator<XWPFTable> itTable = doc.getTablesIterator(); while (itTable.hasNext()) { table = itTable.next(); if (table.getText().indexOf(START_STR) != -1) { parseThisTable(table, map); } } }
text.append(j.next().getText()).append('\n');