通过 Java API 配置输出

文档规范中定义的输出可在 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);
注: 还可以在将模板添加到文档规范时,从该模板配置变量。

反馈