文件規格中所定義的輸出,可在 RPEDocumentSpecification.getRuntime().getOutputs() 集合中找到。
範例顯示如何移除 Microsoft Word 以外的所有輸出,如何變更該輸出的路徑,以及如何設定 Microsoft Word 輸出的樣式表。
List<RPEOutput> toRemove = new ArrayList<RPEOutput>()
for ( RPEOutput output: docspec.getRuntime().getOutputs())
{
String type = PropertyUtils.getPropertyRawValue( output.getProperty( RPEConfigConstants.PROPERTY_TYPE), "");
if ( type.equals( "Word"))
{
Property path = output.getProperty( RPEConfigConstants.PROPERTY_PATH);
Property stylesheet = output.getProperty( RPEConfigConstants.PROPERTY_STYLESHEET);
assert( path != null);
assert( stylesheet != null);
path.setValue( new Value( null, "c:\\test\\output.doc"));
stylesheet.setValue( new Value( null, "c:\\test\\sample_stylesheet.dot"));
}
else
{
toRemove.add( output);
}
}
docspec.getRuntime().getOutputs().removeAll( toRemove);
註: 在您將範本新增至文件規格時,您也可以配置該範本中的變數。