public static void writeDoc(String path) {
try{
FileOutputStream ostream = new FileOutputStream(path);
FileInputStream in = new FileInputStream("C:\\b.doc");
POIFSFileSystem pfs = new POIFSFileSystem(in);
HWPFDocument hwpf = new HWPFDocument(pfs);
Range range = hwpf.getRange();
TableIterator it = new TableIterator(range);
//遍历一个DOC中的所有表格
while (it.hasNext())
{
Table tb = (Table) it.next();
//遍历表格的行
for (int i = 0; i < tb.numRows(); i++)
{
TableRow tr = tb.getRow(i);
//遍历表格的列
for (int j = 0; j < tr.numCells(); j++)
{
//往表格中插入数据
TableCell td = tr.getCell(j);
String text = "第" + i + "行第" + j + "列";
int p = td.numParagraphs();
Paragraph para = td.getParagraph(p);
ParagraphProperties pp = new ParagraphProperties();