XComponent xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream );
if ( xStreamComp == null )
throw new com.sun.star.uno.RuntimeException();
XOutputStream xOutStream = xStream.getOutputStream();
XTruncate xTruncate = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xOutStream );
if ( xTruncate == null )
throw new com.sun.star.io.IOException();
xTruncate.truncate();
xOutStream.writeBytes( aString.getBytes() );
// save the size
xStream = xStorage.openStreamElement( "properties.txt", com.sun.star.embed.ElementModes.READWRITE );
xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream );
if ( xStreamComp == null )
throw new com.sun.star.uno.RuntimeException();
xOutStream = xStream.getOutputStream();
xTruncate = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xOutStream );
if ( xTruncate == null )
throw new com.sun.star.io.IOException();
xTruncate.truncate();
String aProps = Integer.toString( (int)aDimension.getWidth() ) + "|" + Integer.toString( (int)aDimension.getHeight() );
xOutStream.writeBytes( aProps.getBytes() );
// set the media type
XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xStorage );