当前位置: 首页>>代码示例>>Java>>正文


Java JasperPrint.setName方法代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.JasperPrint.setName方法的典型用法代码示例。如果您正苦于以下问题:Java JasperPrint.setName方法的具体用法?Java JasperPrint.setName怎么用?Java JasperPrint.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jasperreports.engine.JasperPrint的用法示例。


在下文中一共展示了JasperPrint.setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: elementToXml

import net.sf.jasperreports.engine.JasperPrint; //导入方法依赖的package包/类
protected String elementToXml(JRPrintElement element)
{
	JRBasePrintPage page = new JRBasePrintPage();
	page.addElement(element);
	JasperPrint jasperPrint = new JasperPrint();
	jasperPrint.addPage(page);
	jasperPrint.setName("test");
	
	StringWriter writer = new StringWriter();
	JRXmlExporter exporter = new JRXmlExporter();
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	SimpleXmlExporterOutput output = new SimpleXmlExporterOutput(writer);
	output.setEmbeddingImages(true);
	exporter.setExporterOutput(output);
	try
	{
		exporter.exportReport();
	}
	catch (JRException e)
	{
		throw new RuntimeException(e);
	}
	return writer.toString();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:BaseElementsTests.java

示例2: createObject

import net.sf.jasperreports.engine.JasperPrint; //导入方法依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
	JasperPrint jasperPrint = new JasperPrint();
	
	jasperPrint.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));

	String pageWidth = atts.getValue(JRXmlConstants.ATTRIBUTE_pageWidth);
	if (pageWidth != null && pageWidth.length() > 0)
	{
		jasperPrint.setPageWidth(Integer.parseInt(pageWidth));
	}

	String pageHeight = atts.getValue(JRXmlConstants.ATTRIBUTE_pageHeight);
	if (pageHeight != null && pageHeight.length() > 0)
	{
		jasperPrint.setPageHeight(Integer.parseInt(pageHeight));
	}

	String topMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_topMargin);
	if (topMargin != null && topMargin.length() > 0)
	{
		jasperPrint.setTopMargin(Integer.valueOf(topMargin));
	}

	String leftMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_leftMargin);
	if (leftMargin != null && leftMargin.length() > 0)
	{
		jasperPrint.setLeftMargin(Integer.valueOf(leftMargin));
	}

	String bottomMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_bottomMargin);
	if (bottomMargin != null && bottomMargin.length() > 0)
	{
		jasperPrint.setBottomMargin(Integer.valueOf(bottomMargin));
	}

	String rightMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_rightMargin);
	if (rightMargin != null && rightMargin.length() > 0)
	{
		jasperPrint.setRightMargin(Integer.valueOf(rightMargin));
	}

	OrientationEnum orientation = OrientationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_orientation));
	if (orientation != null)
	{
		jasperPrint.setOrientation(orientation);
	}
	
	String formatFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_formatFactoryClass);
	if (formatFactoryClass != null)
	{
		jasperPrint.setFormatFactoryClass(formatFactoryClass);
	}
	
	String locale = atts.getValue(JRXmlConstants.ATTRIBUTE_locale);
	if (locale != null)
	{
		jasperPrint.setLocaleCode(locale);
	}
	
	String timezone = atts.getValue(JRXmlConstants.ATTRIBUTE_timezone);
	if (timezone != null)
	{
		jasperPrint.setTimeZoneId(timezone);
	}

	return jasperPrint;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:70,代码来源:JasperPrintFactory.java


注:本文中的net.sf.jasperreports.engine.JasperPrint.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。