title: Extracting the embedded excel (.xlsx)from .xls is not working for 2016 version of excel
body: <pre><code>import java.io.File;
  import java.io.FileOutputStream;
  import java.io.InputStream;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import org.apache.poi.hssf.usermodel.HSSFObjectData;
  import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  import org.apache.poi.poifs.filesystem.DirectoryNode;
  import org.apache.poi.poifs.filesystem.DocumentEntry;
  import org.apache.poi.poifs.filesystem.Entry;
  import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
  import org.apache.poi.util.IOUtils;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  public class TestEmbedded {
     public static void main(String[] args) throws Exception {
         String path = "ParentExcel.xls";
         File file = new File(path);
  
         NPOIFSFileSystem fs = new NPOIFSFileSystem(file);
         HSSFWorkbook wb = new HSSFWorkbook(fs.getRoot(), true);
  
         for (HSSFObjectData obj : wb.getAllEmbeddedObjects()) {
         System.out.println(obj.getDirectory()+"***************HSSFObject data value************"+obj.getOLE2ClassName());
         String oleName = obj.getOLE2ClassName();
         System.out.println("Has directory Entry node"+obj.hasDirectoryEntry());
         DirectoryNode dn = (DirectoryNode)obj.getDirectory();
         Iterator&lt;Entry&gt; ab = dn.getEntries();
         System.out.println("The entries in the directory node are"+dn.getEntries()+"And also the count"+dn.getEntryCount());
  
         if(oleName.contains("Worksheet")){
  
            InputStream is ;
            Entry entry = ab.next();
            is = dn.createDocumentInputStream(entry);
            FileOutputStream fos = new FileOutputStream("EmbeddedWorkbook.xlsx");
            IOUtils.copy(is, fos);
            fos.close();
         }
  
  
         }
  
      }
  }
  </code></pre>
  
  <p>The above code is for extracting the embedded .xlsx from .xls. But it is not working 2016 version of excel. The excel is generated but while opening the excel no contents are present.<a href="https://i.stack.imgur.com/G8AL3.png" rel="nofollow noreferrer">enter image description here</a> </p>