Ok Nick. Are you saying my code is correct and it should work. I am still
trying to do it. I made the file with ms word only. and i am able to read
the same file with a different program i found on the net. This is the code:
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hwpf.*;
import org.apache.poi.hwpf.extractor.*;
import java.io.*;
public class excel {
public static void main(String[] args) {
String filesname = "hello.doc";
POIFSFileSystem fs = null;
try {
fs = new POIFSFileSystem(new
FileInputStream(filesname));
// Couldn't close the braces at the end as my site did
not allow it
// to close
HWPFDocument doc = new HWPFDocument(fs);
WordExtractor we = new WordExtractor(doc);
String[] paragraphs = we.getParagraphText();
System.out.println("Word Document has " +
paragraphs.length
+ " paragraphs");
for (int i = 0; i < paragraphs.length; i++) {
paragraphs[i] =
paragraphs[i].replaceAll("\\cM?\r?\n", "");
System.out.println("Length:" +
paragraphs[i].length());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
can you please explain the steps in readind a doc file and then how to
change margins. Ill be grateful.
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/How-to-change-margins-of-a-word-document-tp5710067p5710090.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]