當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。