use of org.apache.poi.hpbf.model.qcbits.QCBit in project poi by apache.
the class PublisherTextExtractor method getText.
public String getText() {
StringBuffer text = new StringBuffer();
// Get the text from the Quill Contents
QCBit[] bits = doc.getQuillContents().getBits();
for (int i = 0; i < bits.length; i++) {
if (bits[i] != null && bits[i] instanceof QCTextBit) {
QCTextBit t = (QCTextBit) bits[i];
text.append(t.getText().replace('\r', '\n'));
}
}
// how to tie that together.
if (hyperlinksByDefault) {
for (int i = 0; i < bits.length; i++) {
if (bits[i] != null && bits[i] instanceof Type12) {
Type12 hyperlinks = (Type12) bits[i];
for (int j = 0; j < hyperlinks.getNumberOfHyperlinks(); j++) {
text.append("<");
text.append(hyperlinks.getHyperlink(j));
text.append(">\n");
}
}
}
}
return text.toString();
}