32154678925 commented on issue #794:
URL: https://github.com/apache/fesod/issues/794#issuecomment-3747332611
> Based on my understanding, it should only be necessary to change the
`writeSheetHolder` in the `if` condition to `currentWriteHolder`, while keeping
the rest of the logic unchanged.
>
> After changed demo:
>
> View full code
> ExcelWriterBuilder write = FastExcelFactory.write(OUTPUT);
> ExcelWriterSheetBuilder sheetBuilder = write.sheet(0, "测试");
> WriteSheet sheet = sheetBuilder.build();
>
> WriteSheet collect = sheetBuilder
> .relativeHeadRowIndex(1)
> .head(ExcelModel.class)
> .build();
>
> WriteTable tableA = sheetBuilder.table(0)
> .relativeHeadRowIndex(3)
> .head(TableA.class)
> .build();
>
> WriteTable tableB = sheetBuilder.table(1)
> .relativeHeadRowIndex(6)
> .head(TableB.class)
> .build();
>
> try (ExcelWriter writer = write.build()) {
> for (int i = 1; i <= 1; i++) {
> List<ExcelModel> dataList = new ArrayList<>();
> for (int j = 0; j < 10; j++) {
> ExcelModel result = new ExcelModel();
> result.setSchool("湘北高中");
> result.setClazz("一班");
> result.setNo("00" + j);
> dataList.add(result);
> }
> writer.write(dataList, collect);
> }
>
> for (int i = 1; i <= 1; i++) {
> List<TableA> dataList = new ArrayList<>();
> for (int j = 0; j < 10; j++) {
> TableA result = new TableA();
> result.setName("张三");
> result.setAge(18);
> result.setDate(new Date());
> dataList.add(result);
> }
> writer.write(dataList, sheet, tableA);
> }
> for (int i = 1; i <= 1; i++) {
> List<TableB> dataList = new ArrayList<>();
> for (int j = 0; j < 10; j++) {
> TableB result = new TableB();
> result.setHeight(180);
> result.setAddress("北京");
> result.setPhone("12345678901");
> dataList.add(result);
> }
> writer.write(dataList, sheet, tableB);
> }
>
> writer.finish();
> }
> Output:
>
> <img alt="Image" width="238" height="660"
src="https://private-user-images.githubusercontent.com/70380092/535065508-600d92fd-fdf4-4864-bc27-abcab96cf518.PNG?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjgzNTU3NDQsIm5iZiI6MTc2ODM1NTQ0NCwicGF0aCI6Ii83MDM4MDA5Mi81MzUwNjU1MDgtNjAwZDkyZmQtZmRmNC00ODY0LWJjMjctYWJjYWI5NmNmNTE4LlBORz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTE0VDAxNTA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlkNmNkYWRhNTNkMWEyYjgzY2NjMTQ1NGNhMmZjYTliM2EzMzEzODY0ODYzNTEzNTY5ZGM5YWViN2E1MzQ4NTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5NdSjBY0ngZH9VP7SkNKvLdG4uxUXq6Q6HaalypRKCg">
先在sheet写数据后在table写数据是正常的,请问这是标准操作流程么?不能不在sheet写而是只依靠table么
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]