bengbengbalabalabeng commented on issue #665: URL: https://github.com/apache/fesod/issues/665#issuecomment-3477842210
> Just review the original issue, is that a bug? [@delei](https://github.com/delei) [@bengbengbalabalabeng](https://github.com/bengbengbalabalabeng) As header is fixed in entity, seems not required to reset as mutable. If still treat as a bug, please list the sample behavior and expectation. > > As Steps To Reproduce in this issue, seems it's caused by incorrect usage. As original header grammar, user should declare the multiple header as below: > > ``` > @Test > public void dynamicHeadWrite() throws Exception { > List<List<String>> multiHeader = new ArrayList<>(); > multiHeader.add(Arrays.asList("stringTitle1","")); > multiHeader.add(Arrays.asList("stringTitle2","stringTitle2")); > multiHeader.add(Arrays.asList("stringTitle30", "stringTitle31")); > multiHeader.add(Arrays.asList("stringTitle30", "stringTitle32")); > File target = TestFileUtil.createNewFile("dynamicHeadWrite" + System.currentTimeMillis() + ".xlsx"); > FastExcel.write(target) > .head(multiHeader) > .sheet() > .doWrite(Collections.emptyList()); > } > ``` > > Then the header will be merging as expected. <img alt="Image" width="488" height="233" src="https://private-user-images.githubusercontent.com/3264250/508691562-4f373eae-2c60-4f68-b986-2261c7041583.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjIwNzg5MTAsIm5iZiI6MTc2MjA3ODYxMCwicGF0aCI6Ii8zMjY0MjUwLzUwODY5MTU2Mi00ZjM3M2VhZS0yYzYwLTRmNjgtYjk4Ni0yMjYxYzcwNDE1ODMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMDJUMTAxNjUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWNkMWVhMDQ4ODRhYTIyMzlkMmFjMzNmYzc2OGJiYjM0ODYxNWU1YThlMTNmNjk3N2RkMzdkNGFlOGMzMGZmYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.3PWvtXs5l5tjkDZJ-TzEgy0p5kZe-WakQjqIBXTzdCY"> I checked the implementation of `ExcelHeadProperty#initHeadRowNumber`. In this method, the framework explicitly calls `list.add(...)` to pad missing header rows, which means a mutable list is required. If an immutable list (e.g. `Arrays.asList`) is passed, it will inevitably throw `UnsupportedOperationException`. Would it be more accurate to reframe this issue as “An UnsupportedOperationException occurred when padding missing header rows” to better reflect the root cause? -- 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]
