bengbengbalabalabeng commented on issue #665:
URL: https://github.com/apache/fesod/issues/665#issuecomment-3477914831

   > > > 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 . In this method, the framework 
explicitly calls  to pad missing header rows, which means a mutable list is 
required. If an immutable list (e.g. ) is passed, it will inevitably throw 
.`ExcelHeadProperty#initHeadRowNumber``list.add(...)``Arrays.asList``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?
   > 
   > Can you list the post behavior since given change in another PR? Caused by 
original issue is from incorrect usage (refer to the original comment and my 
attached screenshot) , and we still not sure the actual behavior from your 
commits, not sure the final impact on existing functions.
   
   Code:
   
   ```java
       @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());
       }
   ```
   
   After this change, the behavior of column A will be aligned with that of 
column B.
   
   <img width="478" height="105" alt="Image" 
src="https://github.com/user-attachments/assets/5ee3e4aa-d5e3-49ea-ad73-c1a5a1d05486";
 />


-- 
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]

Reply via email to