View | Details | Raw Unified | Return to bug 45043
Collapse All | Expand All

(-)src/java/org/apache/poi/hssf/extractor/ExcelExtractor.java (+14 lines)
Lines 20-25 Link Here
20
20
21
import org.apache.poi.POIOLE2TextExtractor;
21
import org.apache.poi.POIOLE2TextExtractor;
22
import org.apache.poi.hssf.usermodel.HSSFCell;
22
import org.apache.poi.hssf.usermodel.HSSFCell;
23
import org.apache.poi.hssf.usermodel.HSSFComment;
23
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
24
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
24
import org.apache.poi.hssf.usermodel.HSSFRow;
25
import org.apache.poi.hssf.usermodel.HSSFRow;
25
import org.apache.poi.hssf.usermodel.HSSFSheet;
26
import org.apache.poi.hssf.usermodel.HSSFSheet;
Lines 39-44 Link Here
39
	private HSSFWorkbook wb;
40
	private HSSFWorkbook wb;
40
	private boolean includeSheetNames = true;
41
	private boolean includeSheetNames = true;
41
	private boolean formulasNotResults = false;
42
	private boolean formulasNotResults = false;
43
	private boolean includeCellComments = false;
42
	
44
	
43
	public ExcelExtractor(HSSFWorkbook wb) {
45
	public ExcelExtractor(HSSFWorkbook wb) {
44
		super(wb);
46
		super(wb);
Lines 62-67 Link Here
62
	public void setFormulasNotResults(boolean formulasNotResults) {
64
	public void setFormulasNotResults(boolean formulasNotResults) {
63
		this.formulasNotResults = formulasNotResults;
65
		this.formulasNotResults = formulasNotResults;
64
	}
66
	}
67
	/**
68
     * Should cell comments be included? Default is true
69
     */
70
    public void setIncludeCellComments(boolean includeCellComments) {
71
        this.includeCellComments = includeCellComments;
72
    }
65
	
73
	
66
	/**
74
	/**
67
	 * Retreives the text contents of the file
75
	 * Retreives the text contents of the file
Lines 128-133 Link Here
128
							break;
136
							break;
129
					}
137
					}
130
					
138
					
139
					if(includeCellComments && cell.getCellComment() != null)
140
					{
141
					    HSSFComment comment = cell.getCellComment();
142
					    text.append(" Comment by "+comment.getAuthor()+": "+comment.getString());
143
					}
144
					
131
					// Output a tab if we're not on the last cell
145
					// Output a tab if we're not on the last cell
132
					if(outputContents && k < (lastCell-1)) {
146
					if(outputContents && k < (lastCell-1)) {
133
						text.append("\t");
147
						text.append("\t");

Return to bug 45043