32154678925 opened a new pull request, #810:
URL: https://github.com/apache/fesod/pull/810

   ## Purpose of the pull request
   Fixes(#794)
   When you do not write directly in the `sheet`, but only write data in the 
`table `and set the `head`, the offset value set with `relativeHeadRowIndex()` 
will make an error, and the blank line with the specified offset will be empty 
again between the head and the data. If the `head `is not set, the offset value 
set with `relativeHeadRowIndex()` will not take effect
   
   ## What's changed?
   Change the judgment of whether to add offset in the `add` method in the 
`ExcelWriteAddExecutor` class from `writeSheetHolder` to `currentWriteHolder`
   
   **Before**:
   `WriteSheetHolder writeSheetHolder = writeContext.writeSheetHolder();
   int newRowIndex = writeSheetHolder.getNewRowIndexAndStartDoWrite();
   if (writeSheetHolder.isNew()
           && !writeSheetHolder.getExcelWriteHeadProperty().hasHead()) {
       newRowIndex += writeContext.currentWriteHolder().relativeHeadRowIndex();
   }`
   
   **After**:
   `WriteSheetHolder writeSheetHolder = writeContext.writeSheetHolder();
   WriteHolder currentWriteHolder = writeContext.currentWriteHolder();
   int newRowIndex = writeSheetHolder.getNewRowIndexAndStartDoWrite();
   if (currentWriteHolder.isNew()) {
       if(currentWriteHolder instanceof AbstractWriteHolder){
           AbstractWriteHolder writeHolder = (AbstractWriteHolder) 
currentWriteHolder;
           if(!writeHolder.getExcelWriteHeadProperty().hasHead()){
               newRowIndex += currentWriteHolder.relativeHeadRowIndex();
           }
       }
   }`
   
   ## Checklist
   
   - [x] I have read the [Contributor 
Guide](https://fesod.apache.org/community/contribution/).
   - [ ] I have written the necessary doc or comment.
   - [x] I have added the necessary unit tests and all cases have passed.
   


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