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

   Or try this approach:
   
   Use a unified annotation:
   
   ```java
   public @interface ExcelView {
   
       Class<?>[] asTypes() default {};
       
       String[] asStrings() default {};
   }
   
   enum SheetGroupView {
       BY_TYPE_BASED, // Or BY_MARKER_INTERFACE
       BY_STRING_BASED
   }
   ```
   
   Usage example:
   
   ```java
   // Use Type-Based
   @ExcelView(asTypes = Details.class)
   @ExcelProperty(value = "Name")
   private String name;
   
   FesodSheet.write(fileName)
       .head(OrderData.class)
       // .view(SheetGroupView.BY_TYPE_BASED, DetailGroup.class)
       .group(DetailGroup.class)
       .sheet()
       .doWrite(dataList);
   
   // Use String-Based
   @ExcelView(asStrings = "detail")
   @ExcelProperty(value = "Name")
   private String name;
   
   FesodSheet.write(fileName)
       .head(OrderData.class)
       // .view(SheetGroupView.BY_STRING_BASED, "base", "detail")
       .tag("base", "detail")
       .sheet()
       .doWrite(dataList);
   
   // When used simultaneously, only the last assignment takes effect.
   FesodSheet.write(fileName)
       .head(OrderData.class)
       .group(DetailGroup.class) // Not effective
       .tag("base", "detail")
       .sheet()
       .doWrite(dataList);
   ```
   
   With this design, `SheetGroupView` acts as an explicit switch that 
determines how the grouping values should be interpreted.
   
   This approach supporting both marker‑interface grouping and lightweight 
string‑based tags. *(However, I still recommend with the Class/Interface 
approach)*
   
   WDYT? @delei 


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