That is a simple docx file (test1.docx) , it is created by MS Office 2016
professional
It can be opened successfully.
张小辉
星环科技/数据工程部
18701960364
From: Jörn Franke [via Apache POI]
Date: 2017-05-18 14:32
To: xjtuzxh
Subject: Re: new XWPFDocument(fis) is blocked
Have you tried another file? How was this file created? Maybe it is broken in a
very weird way.
> On 18. May 2017, at 04:26, xjtuzxh <[hidden email]> wrote:
>
> Thanks for your reply
>
> I have added log output, as follow:
> writer = new BufferedWriter(new FileWriter(textFile));
> InputStream is = new FileInputStream(file);
>
> LOGGER.info("bytes:{}",is.available());
> LOGGER.info("SIGN1");
> document = new XWPFDocument(is);
> LOGGER.info("SIGN2");
> if(null == document){
> LOGGER.info("document is null");
> }
>
> extractor = new XWPFWordExtractor(document);
> writer.write(extractor.getText());
> writer.flush();
> LOGGER.info("Extract text from {}, write text to {}", file.getName(),
> textFile);
>
> the output is as follow:
> [INFO ][2017-05-18
> 10:19:41][io.transwarp.extractor.ExtractorWorker.run(ExtractorWorker.java:27)]pool-1-thread-1
> start extracting doc:E:\IDEA\DocumentDemo\document_dir\test.docx
> [INFO ][2017-05-18
> 10:19:41][io.transwarp.docutils.DocxExtractor.extract(DocxExtractor.java:41)]bytes:13331
>
> [INFO ][2017-05-18
> 10:19:41][io.transwarp.docutils.DocxExtractor.extract(DocxExtractor.java:42)]SIGN1
>
>
> the code after "document = new XWPFDocument(is);" is not executed and the
> application is in RUNNING STATE , and no exception or error is reported.
> I am also puzzled!!!
>
> 张小辉
> 星环科技/数据工程部
> 18701960364
>
> From: Javen O'Neal-2 [via Apache POI]
> Date: 2017-05-18 01:23
> To: xjtuzxh
> Subject: Re: new XWPFDocument(fis) is blocked
>> blocked
>> no exception or error is reported
>
> Either `new XWPFDocument(is)` returns a document, null (unlikely), or
> throws an exception. Which one is it? "Blocked" isn't specific enough to me
> to describe what happens.
>
> On May 17, 2017 6:46 AM, "xjtuzxh" <[hidden email]> wrote:
>
> hi all,
> This is my first topic on POI, I am from china so my English is a little
> poor.
>
> I am trying extract text from *.docx file which can be opened using the
> following code, but it is blocked when executing this statement:
> document = new XWPFDocument(is);
> no exception or error is reported. so how to debug.
>
>
> CODE:
> InputStream is = new FileInputStream(file);
> System.out.println(is.available());
> document = new XWPFDocument(is);
> extractor = new XWPFWordExtractor(document);
> writer.write(extractor.getText());
> writer.flush();
>
>
> version of poi jars: 3.16
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.
> nabble.com/new-XWPFDocument-fis-is-blocked-tp5727565.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
>
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-poi.1045710.n5.nabble.com/new-XWPFDocument-fis-is-blocked-tp5727565p5727570.html
>
> To unsubscribe from new XWPFDocument(fis) is blocked, click here.
> NAML
>
>
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/new-XWPFDocument-fis-is-blocked-tp5727565p5727578.html
> Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
If you reply to this email, your message will be added to the discussion below:
http://apache-poi.1045710.n5.nabble.com/new-XWPFDocument-fis-is-blocked-tp5727565p5727579.html
To unsubscribe from new XWPFDocument(fis) is blocked, click here.
NAML
test1.docx (17K)
<http://apache-poi.1045710.n5.nabble.com/attachment/5727581/0/test1.docx>
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/new-XWPFDocument-fis-is-blocked-tp5727565p5727581.html
Sent from the POI - User mailing list archive at Nabble.com.