protected static void SaveDataToStorage( XStorage xStorage, String aString, Dimension aDimension ) throws com.sun.star.io.IOException
{
try
{
// save the text
XStream xStream = xStorage.openStreamElement( "content.txt", com.sun.star.embed.ElementModes.READWRITE );
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();