[
https://issues.apache.org/jira/browse/TIKA-2734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653483#comment-16653483
]
Tim Allison commented on TIKA-2734:
-----------------------------------
The facade method of calling Tika doesn't include a ParseContext, so you have
to go the old fashioned way:
{noformat}
Parser p = new AutoDetectParser();
ContentHandler handler = new ToTextContentHandler();
Metadata m = new Metadata();
ParseContext parseContext = new ParseContext();
OfficeParserConfig config = new OfficeParserConfig();
config.setIncludeHeadersAndFooters(false);
parseContext.set(OfficeParserConfig.class, config);
try (TikaInputStream tis = TikaInputStream.get(bytes)) {
p.parse(tis, m, handler, parseContext);
}
String result = handler.toString();
{noformat}
Notes:
* You don't need to detect first and do an "if" call to determine whether or
not to add the OfficeParserConfig. I'd add the OfficeParserConfig with each
call.
* You can reuse the AutoDetectParser, and can use it in multiple threads
* Always, always use TikaInputStream.get() when possible. If you are handling
files, it is most efficient to use TikaInputStream.get(Path p, Metadata m).
> Tika addes extra characters at the end of text in extracting from excel file
> ----------------------------------------------------------------------------
>
> Key: TIKA-2734
> URL: https://issues.apache.org/jira/browse/TIKA-2734
> Project: Tika
> Issue Type: Bug
> Components: handler
> Affects Versions: 1.18
> Reporter: feng ye
> Priority: Major
> Attachments: AIRPORTSOK.xls, extra_A_Page_P.png
>
>
> when extracting text from some relatively large excel files (9000 rows or
> so), I found an extra string of "&A PAGE &P" is added to the end of the
> resulting text, when Tika.parseToString is called. Is it a known issue? Is
> there any configuration that I can do that will opt out from outputting these
> extra characters?
> did not find a good answer over google.
> the input excel spreadsheet is attached.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)