本文整理汇总了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();
}
示例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;
}