这么写试试 
"参数内容"+(char)11+"换行"

解决方案 »

  1.   

    那个我试了,网上说可以,但是我的测试结果是,(char)11变成了?A
      

  2.   

    那个我试了,网上说可以,但是我的测试结果是,(char)11变成了?AASCii码试试呢
      

  3.   

    官方的examples里有一个/**
     * How to use newlines in cells
     */
    public class NewLinesInCells {    public static void main(String[]args) throws Exception {
            Workbook wb = new XSSFWorkbook();   //or new HSSFWorkbook();
            Sheet sheet = wb.createSheet();        Row row = sheet.createRow(2);
            Cell cell = row.createCell(2);
            cell.setCellValue("Use \n with word wrap on to create a new line");        //to enable newlines you need set a cell styles with wrap=true
            CellStyle cs = wb.createCellStyle();
            cs.setWrapText(true);
            cell.setCellStyle(cs);        //increase row height to accomodate two lines of text
            row.setHeightInPoints((2*sheet.getDefaultRowHeightInPoints()));        //adjust column width to fit the content
            sheet.autoSizeColumn(2);        FileOutputStream fileOut = new FileOutputStream("ooxml-newlines.xlsx");
            wb.write(fileOut);
            fileOut.close();
        }}
    应该可以的
      

  4.   

    目前用4楼提供的一个链接解决的
    http://stackoverflow.com/questions/7477335/java-apache-poi-newline-characters-are-ignored-when-writing-to-xwpftable-cell
    XWPFParagraph para = row.getCell(i).getParagraphs().get(0);
    for(String text : myStrings){
        XWPFRun run = para.createRun();
        run.setText(text.trim());
        run.addBreak();
    }
    不过感觉有点繁琐,每次都要来个循环大家平时导出word用什么第三方的API?