KrisPatAU opened a new issue, #966:
URL: https://github.com/apache/poi/issues/966

   In 5.x versions, while creating a sheet, it was decided to truncate its name:
   
   `String sn = (sheetname.length() > 31) ? sheetname.substring(0, 31) : 
sheetname;`
   
   But as a consequence, trying to get the sheet using the same original name 
results in null.
   
   `import org.apache.poi.ss.usermodel.Sheet;
   import org.apache.poi.ss.usermodel.Workbook;
   import org.apache.poi.hssf.usermodel.HSSFWorkbook;
   
   public class ApachePOISheetNameTest {
        private static final String LONG_SHEET_NAME = 
"ThisSheetNameIsMoreThan31Characters";
   
        public static void main(String[] args) throws Exception {
                try (Workbook workbook = new HSSFWorkbook()) {
                        workbook.createSheet(LONG_SHEET_NAME);
                        Sheet sheet = workbook.getSheet(LONG_SHEET_NAME);
                        System.out.println(sheet);      // null
                        sheet = workbook.getSheet(LONG_SHEET_NAME.substring(0, 
31));
                        System.out.println(sheet);      // works
                }
        }
   
   }
   `


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