SXSSFWorkbook流API:写入行(createRow)

时间:2019-10-23 16:49:42

标签: java excel apache-poi xssf sxssf

我有点迷茫,如何在Streaming SXSSF Apache POI API中写行?

views.py

class ArticleListView(generics.ListAPIView):
queryset=Article.objects.all()
serializer_class=ArticleSerializer

class ArticleDetailView(generics.RetrieveAPIView):
queryset=Article.objects.all()
serializer_class=ArticleSerializer

urls.py
urlpatterns=[
url('',ArticleListView.as_view()),
url('<int:pk>',ArticleDetailView.as_view()),
]


picture of 127.0.0.1:8000/api/1
Article List

Article List
GET /api/1
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

[
{
    "title": "Test debut",
    "content": "this is the debut for the test",
    "description": "2019-10-22 08:46:05.964656+00:00"
},
{
    "title": "2nd Test",
    "content": "This is the second test article for the djreact 
app",
    "description": "2019-10-22 08:46:05.964656+00:00"
},
{
    "title": "3rd article",
    "content": "content for 3rd article",
    "description": "description for 3rd article"
}
]

存在演员表问题:

1) SXSSFWorkbook workbook = new SXSSFWorkbook(new XSSFWorkbook(in), 100); SXSSFSheet sheet = workbook.createSheet("Sheet1"); // write rows data Iterator<List<String>> itRows = data.iterator(); while (itRows.hasNext()) { SXSSFRow row = sheet.createRow(rownum++); int cellnum = 0; Iterator<String> itCells = itRows.next().iterator(); while (itCells.hasNext()) { SXSSFCell cell = row.createCell(cellnum++); cell.setCellValue(itCells.next()); } } 不起作用,我得到的结果是SXSSFSheet sheet

2)但是我不能Sheetsheet.createRow(..)

0 个答案:

没有答案