Browse Source

adjust ExcelExtractor interface

pull/37/head
Tony Qu 11 years ago
parent
commit
bdb4f6195b
  1. 3
      main/HSSF/Extractor/ExcelExtractor.cs
  2. 22
      main/SS/Extractor/ExcelExtractor.cs
  3. 63
      ooxml/XSSF/Extractor/XSSFExcelExtractor.cs

3
main/HSSF/Extractor/ExcelExtractor.cs

@ -25,6 +25,7 @@ namespace NPOI.HSSF.Extractor
using NPOI;
using NPOI.SS.Formula.Eval;
using NPOI.SS.UserModel;
using NPOI.SS.Extractor;
/// <summary>
/// A text extractor for Excel files.
@ -32,7 +33,7 @@ namespace NPOI.HSSF.Extractor
/// indexing by something like Lucene, but not really
/// intended for display to the user.
/// </summary>
public class ExcelExtractor : POIOLE2TextExtractor
public class ExcelExtractor : POIOLE2TextExtractor, IExcelExtractor
{
private HSSFWorkbook wb;
private HSSFDataFormatter _formatter;

22
main/SS/Extractor/ExcelExtractor.cs

@ -22,24 +22,12 @@ namespace NPOI.SS.Extractor
* Common interface for Excel text extractors, covering
* HSSF and XSSF
*/
public interface ExcelExtractor
public interface IExcelExtractor
{
/**
* Should sheet names be included? Default is true
*/
void SetIncludeSheetNames(bool includeSheetNames);
/**
* Should we return the formula itself, and not
* the result it produces? Default is false
*/
void SetFormulasNotResults(bool formulasNotResults);
/**
* Should cell comments be included? Default is false
*/
void SetIncludeCellComments(bool includeCellComments);
bool IncludeCellComments { get; set; }
bool IncludeSheetNames { get; set; }
bool FormulasNotResults { get; set; }
bool IncludeHeaderFooter { get; set; }
/**
* Retreives the text contents of the file
*/

63
ooxml/XSSF/Extractor/XSSFExcelExtractor.cs

@ -26,7 +26,7 @@ namespace NPOI.XSSF.Extractor
/**
* Helper class to extract text from an OOXML Excel file
*/
public class XSSFExcelExtractor : POIXMLTextExtractor, NPOI.SS.Extractor.ExcelExtractor
public class XSSFExcelExtractor : POIXMLTextExtractor, NPOI.SS.Extractor.IExcelExtractor
{
public static XSSFRelation[] SUPPORTED_TYPES = new XSSFRelation[] {
XSSFRelation.WORKBOOK, XSSFRelation.MACRO_TEMPLATE_WORKBOOK,
@ -56,7 +56,66 @@ namespace NPOI.XSSF.Extractor
this.workbook = workbook;
}
/// <summary>
/// Should header and footer be included? Default is true
/// </summary>
public bool IncludeHeaderFooter
{
get
{
return this.includeHeadersFooters;
}
set
{
this.includeHeadersFooters = value;
}
}
/// <summary>
/// Should sheet names be included? Default is true
/// </summary>
/// <value>if set to <c>true</c> [include sheet names].</value>
public bool IncludeSheetNames
{
get
{
return this.includeSheetNames;
}
set
{
this.includeSheetNames = value;
}
}
/// <summary>
/// Should we return the formula itself, and not
/// the result it produces? Default is false
/// </summary>
/// <value>if set to <c>true</c> [formulas not results].</value>
public bool FormulasNotResults
{
get
{
return this.formulasNotResults;
}
set
{
this.formulasNotResults = value;
}
}
/// <summary>
/// Should cell comments be included? Default is false
/// </summary>
/// <value>if set to <c>true</c> [include cell comments].</value>
public bool IncludeCellComments
{
get
{
return this.includeCellComments;
}
set
{
this.includeCellComments = value;
}
}
/**
* Should sheet names be included? Default is true
*/

Loading…
Cancel
Save