*/
// KSC: unsure if it's absolutely necessary to also have CompObj storage
try {
directories.getDirectoryByName("\1CompObj");
} catch (StorageNotFoundException e) {
Storage compObj= directories.createStorage("\1CompObj", 2, directories.getDirectoryStreamID("\005DocumentSummaryInformation")+1);
compObj.setBytesWithOverage(new byte[] {1, 0, -2, -1, 3, 10, 0, 0, -1, -1, -1, -1, 32, 8, 2, 0, 0, 0, 0, 0, -64, 0, 0, 0, 0, 0, 0, 70, 38, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 79, 102, 102, 105, 99, 101, 32, 69, 120, 99, 101, 108, 32, 50, 48, 48, 51, 32, 87, 111, 114, 107, 115, 104, 101, 101, 116, 0, 6, 0, 0, 0, 66, 105, 102, 102, 56, 0, 14, 0, 0, 0, 69, 120, 99, 101, 108, 46, 83, 104, 101, 101, 116, 46, 56, 0, -12, 57, -78, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
int compObjid= directories.getDirectoryStreamID("\1CompObj");
Storage wb= directories.getDirectoryByName("Workbook");
wb.setPrevStorageID(compObjid);
}
/* create _SX_DB_CUR + child (actual pivot cache) directory and put in proper order in directory array */
Storage sx_db_cur= directories.createStorage("_SX_DB_CUR", 1, directories.getDirectoryStreamID("\005SummaryInformation")); // Pivot Cache Storage: (id= 1) insert just before SummaryInfo -- ALWAYS ??????
int sxdbcurid= directories.getDirectoryStreamID("_SX_DB_CUR"); //
Storage pcache1= directories.createStorage("0001", 2, sxdbcurid + 1); // TODO: handle multiple Caches ... 0002 ...
directories.getDirectoryByName("Root Entry").setChildStorageID(sxdbcurid);
sx_db_cur.setPrevStorageID(directories.getDirectoryStreamID("Workbook"));
sx_db_cur.setChildStorageID(directories.getDirectoryStreamID("0001")); // child= 0001 Cache Stream (id= 2)
sx_db_cur.setNextStorageID(directories.getDirectoryStreamID("\005SummaryInformation"));
Storage si= directories.getDirectoryByName("\005SummaryInformation");
si.setPrevStorageID(-1); // Necessary?????????
si.setNextStorageID(directories.getDirectoryStreamID("\005DocumentSummaryInformation"));
directories.getDirectoryByName("Root Entry").setChildStorageID(sxdbcurid); // ??? ALWAYS ????
// create pivot cache records which are source of actual pivot cache data
byte[] newbytes= createPivotCacheRecords(ref, wbh, sId);
pcache1.setBytesWithOverage(newbytes);