public void testWrite()
	{

		try
		{
			java.io.File f = new java.io.File( wd + foutpath );

			// create directories
			try
			{
				if( !f.exists() )
				{
					f.mkdirs();
					f.delete();
				}
			}
			catch( Exception e )
			{
				;
			}

			FileOutputStream fos = new FileOutputStream( f );

			// if the file is Excel 2007 format, we use "write" method
			// which auto-detects spreadsheet format
			if( book.getIsExcel2007() )
			{
				log.info( book.toString() + " is an Excel 2007/2010 XLSX spreadsheet." );
			}

			if( WRITE_AUTO )
			{ // to auto-detect file type, use WorkBookHandle.write(OutputStream out) method
				book.write( fos );
			}
			else if( WRITE_XLS )
			{ // we can write out XLS explicitly if we like
				BufferedOutputStream bbout = new BufferedOutputStream( fos );
				book.write( bbout );
				bbout.flush();
				bbout.close();
				fos.flush();
				fos.close();
			}
			else if( WRITE_XLSX )
			{ // we can write out XLSX explicitly if we like
				int format = WorkBookHandle.FORMAT_XLSX;
				if( foutpath.toLowerCase().endsWith( ".xlsm" ) )
				{
					format = WorkBookHandle.FORMAT_XLSM;
				}
				BufferedOutputStream bbout = new BufferedOutputStream( fos );
				book.write( bbout, format );
				bbout.flush();
				bbout.close();
				fos.flush();
				fos.close();

			}

			book = new WorkBookHandle( wd + foutpath );

		}
		catch( Exception e )
		{
			log.error( "Exception in Excel2007Test.", e );
		}
	}