if (file == null || file.isDirectory()) return false;  if (!updateStorage()) return false;   int[] address = new int[1]; if (objIOleObject.QueryInterface(COM.IIDIPersistStorage, address) != COM.S_OK) return false; IPersistStorage permStorage = new IPersistStorage(address[0]);
private boolean saveToStorageFile(File file) {	// Note: if the file already exists, some applications will not overwrite the file	// In these cases, you should delete the file first (probably save the contents of the file in case the	// save fails)	if (file == null || file.isDirectory())		return false;			if (!updateStorage())		return false;		// get access to the persistant storage mechanism	int[] address = new int[1];	if (objIOleObject.QueryInterface(COM.IIDIPersistStorage, address) != COM.S_OK)		return false;	IPersistStorage permStorage = new IPersistStorage(address[0]);		// The file will be saved using the formating of the current application - this	// may not be the format of the application that was originally used to create the file	// e.g. if an Excel file is opened in Word, the Word application will save the file in the 	// Word format	boolean success = false;	OleFile oleFile = new OleFile(file, null, OleFile.WRITE);	IStorage storage = oleFile.getRootStorage();	storage.AddRef();	if (COM.OleSave(permStorage.getAddress(), storage.getAddress(), false) == COM.S_OK) {		if (storage.Commit(COM.STGC_DEFAULT) == COM.S_OK)			success = true;	}	storage.Release();	oleFile.dispose();	permStorage.Release();		return success;}