{
try
{
Object oTempFile = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.io.TempFile", xContext );
XStream xStream = ( XStream ) UnoRuntime.queryInterface( XStream.class, oTempFile );
XSeekable xSeekable = ( XSeekable ) UnoRuntime.queryInterface( XSeekable.class, oTempFile );
if ( xStream != null && xSeekable != null )
{
XOutputStream xOutputStream = xStream.getOutputStream();
XInputStream xInputStream = xStream.getInputStream();
if ( xOutputStream != null && xInputStream != null )
{
String sHTML = sHTMLHeader.concat( sArticle );
sHTML = sHTML.concat( sHTMLFooter );
xOutputStream.writeBytes( sHTML.getBytes( "UTF-8" ) );
// xOutputStream.closeOutput();
xSeekable.seek( 0 );
xResult = xInputStream;
}
}
}