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


Java JasperCompileManager.compileReportToFile方法代码示例

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


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

示例1: compileReportToJasperFile

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * jasperreport compile jrxml 成 jasper
 * 
 * @param sourceFile		如: File[]
 * @param destDir			如: C:/report/     產生一個 test.jasper 到 C:/report/ 中
 * @return
 * @throws JRException
 */
public static String compileReportToJasperFile(File sourceFile[], String destDir) throws JRException {
	String jasperFirst = "";
	for (int ix=0; sourceFile!=null && ix<sourceFile.length; ix++) {
		File srcFile = sourceFile[ix];
		if (!srcFile.exists() || srcFile.getName().indexOf(".jrxml")==-1) {
			srcFile=null;
			continue;
		}
		//String destFileName=srcFile.getName().replaceAll(".jrxml", ".jasper");
		String destFileName=srcFile.getPath().replaceAll(".jrxml", ".jasper");
		if ("".equals(jasperFirst)) {
			jasperFirst = destFileName;
		}
		JasperCompileManager.compileReportToFile(srcFile.getPath(), destFileName);
		logger.info("out process : " + destFileName);
	}
	return jasperFirst;
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:27,代码来源:JReportUtils.java

示例2: compileQueryReport

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compilez raportul pentru query
 */
public static void compileQueryReport() {
   String subreportFolder,subreportPath;
   String compiledSubFolder, compiledSubPath;

    //Subreport
    subreportFolder = ReadOnlyConfiguration.getString("JASPER_TEMPLATE_FOLDER");
    subreportPath = subreportFolder+ReadOnlyConfiguration.getString("JASPER_TEMPLATE_SUB_QUERY");
    compiledSubFolder = ReadOnlyConfiguration.getString("JASPER_COMPILED_FOLDER");
    compiledSubPath = compiledSubFolder+ReadOnlyConfiguration.getString("JASPER_COMPILED_SUB_QUERY");

    //Compilez si populez subreportul
    try
    {
        JasperCompileManager.compileReportToFile(
                subreportPath,
                compiledSubPath);
    }
    catch (JRException ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:26,代码来源:ResultReportTestReport.java

示例3: compileMapping

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compilez raportul Mapare
 */
public static void compileMapping() {
   String subreportFolder,subreportPath;
   String compiledSubFolder, compiledSubPath;

    //Subreport
    subreportFolder = ReadOnlyConfiguration.getString("JASPER_TEMPLATE_FOLDER");
    subreportPath = subreportFolder+ReadOnlyConfiguration.getString("JASPER_TEMPLATE_SUB_MAPPING");
    compiledSubFolder = ReadOnlyConfiguration.getString("JASPER_COMPILED_FOLDER");
    compiledSubPath = compiledSubFolder+ReadOnlyConfiguration.getString("JASPER_COMPILED_SUB_MAPPING");

    //Compilez si populez subreportul
    try
    {
        JasperCompileManager.compileReportToFile(
                subreportPath,
                compiledSubPath);
    }
    catch (JRException ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:26,代码来源:ResultReportTestReport.java

示例4: compileSmithReport

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compilez raportul Smith-Waterman
 */
public static void compileSmithReport() {
   String subreportFolder,subreportPath;
   String compiledSubFolder, compiledSubPath;

    //Subreport
    subreportFolder = ReadOnlyConfiguration.getString("JASPER_TEMPLATE_FOLDER");
    subreportPath = subreportFolder+ReadOnlyConfiguration.getString("JASPER_TEMPLATE_SUB_SMITH_WATERMAN");
    compiledSubFolder = ReadOnlyConfiguration.getString("JASPER_COMPILED_FOLDER");
    compiledSubPath = compiledSubFolder+ReadOnlyConfiguration.getString("JASPER_COMPILED_SUB_SMITH_WATERMAN");

    //Compilez si populez subreportul
    try
    {
        JasperCompileManager.compileReportToFile(
                subreportPath,
                compiledSubPath);
    }
    catch (JRException ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:26,代码来源:ResultReportTestReport.java

示例5: compilePositioning

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compilez raportul Smith-Waterman
 */
public static void compilePositioning() {
   String subreportFolder,subreportPath;
   String compiledSubFolder, compiledSubPath;

    //Subreport
    subreportFolder = ReadOnlyConfiguration.getString("JASPER_TEMPLATE_FOLDER");
    subreportPath = subreportFolder+ReadOnlyConfiguration.getString("JASPER_TEMPLATE_SUB_POSITIONING");
    compiledSubFolder = ReadOnlyConfiguration.getString("JASPER_COMPILED_FOLDER");
    compiledSubPath = compiledSubFolder+ReadOnlyConfiguration.getString("JASPER_COMPILED_SUB_POSITIONING");

    //Compilez si populez subreportul
    try
    {
        JasperCompileManager.compileReportToFile(
                subreportPath,
                compiledSubPath);
    }
    catch (JRException ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:26,代码来源:ResultReportTestReport.java

示例6: compileGenes

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compilez raportul Smith-Waterman
 */
public static void compileGenes() {
   String subreportFolder,subreportPath;
   String compiledSubFolder, compiledSubPath;

    //Subreport
    subreportFolder = ReadOnlyConfiguration.getString("JASPER_TEMPLATE_FOLDER");
    subreportPath = subreportFolder+ReadOnlyConfiguration.getString("JASPER_TEMPLATE_SUB_GENES");
    compiledSubFolder = ReadOnlyConfiguration.getString("JASPER_COMPILED_FOLDER");
    compiledSubPath = compiledSubFolder+ReadOnlyConfiguration.getString("JASPER_COMPILED_SUB_GENES");

    //Compilez si populez subreportul
    try
    {
        JasperCompileManager.compileReportToFile(
                subreportPath,
                compiledSubPath);
    }
    catch (JRException ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:26,代码来源:ResultReportTestReport.java

示例7: compileReportTemplate

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * complie the report template xml file into a Jasper report file if the compiled file does not exist or is out of update
 * 
 * @param designTemplate the full name of the report template xml file
 * @param jasperReport the full name of the compiled report file
 */
protected void compileReportTemplate(String designTemplate, String jasperReport) throws JRException {
    File jasperFile = new File(jasperReport);
    File designFile = new File(designTemplate);

    if (!jasperFile.exists() && !designFile.exists()) {
        throw new RuntimeException("Both the design template file and jasper report file don't exist: (" + designTemplate + ", " + jasperReport + ")");
    }

    if (!jasperFile.exists() && designFile.exists()) {
        JasperCompileManager.compileReportToFile(designTemplate, jasperReport);
    }
    else if (jasperFile.exists() && designFile.exists()) {
        if (jasperFile.lastModified() < designFile.lastModified()) {
            JasperCompileManager.compileReportToFile(designTemplate, jasperReport);
        }
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:24,代码来源:ReportGenerationServiceImpl.java

示例8: compileReport

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compile jasper .jrxml source file if compiled .jasper is missing or older than source
 * 
 * @param filename
 * @return JasperReport
 * @throws IOException
 * @throws JRException
 */
private void compileReport(String jasperFileName) throws IOException, JRException {
    if (!jasperFileName.endsWith(".jasper")) {
    	throw new JRException("Bad file extension, should be .jasper: " + jasperFileName);
    }
    String sourceFileName = jasperFileName.substring(0, jasperFileName.length()-7) + ".jrxml";
    File source = new File(sourceFileName);
    File compiled = new File(jasperFileName);
    if (!source.exists()) {
        throw new IOException("Missing source JRXML file " + sourceFileName);
    }
    
    if(!compiled.exists() || (compiled.lastModified() < source.lastModified())) {
    	log.debug("compiling source report: " + sourceFileName);
        JasperCompileManager.compileReportToFile(sourceFileName, jasperFileName);
    } else {
    	log.debug("source report compilation not needed");        	
    }
}
 
开发者ID:stefanorosanelli,项目名称:jasper-service,代码行数:27,代码来源:JasperProcess.java

示例9: compile

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 *
 */
public void compile() throws JRException
{
	long start = System.currentTimeMillis();
	JasperCompileManager.compileReportToFile("reports/QueryReport.jrxml", "build/reports/QueryReport.jasper");
	System.err.println("Compile time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:10,代码来源:QueryApp.java

示例10: compile

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 *
 */
public void compile() throws JRException
{
	long start = System.currentTimeMillis();
	JasperDesign jasperDesign = getJasperDesign();
	JasperCompileManager.compileReportToFile(jasperDesign, "build/reports/NoXmlDesignReport.jasper");
	System.err.println("Compile time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:11,代码来源:NoXmlDesignApp.java

示例11: compileAllReports

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Compilez toate raportele
 */
public void compileAllReports(String folderSursa,String folderDestinatie) {
    //Fac o structura de tip sursa-destinatie
    Vector <Node> rapoarte = new Vector<Node>();

    //Obtin folderele
    File templateFolder = new File(folderSursa);
    File[] templateFiles = templateFolder.listFiles(fileFilter);
    for (int i = 0; i < templateFiles.length; i++) {
        File file = templateFiles[i];
        String basename = getBasename(file.getName());
        String path = folderDestinatie+"/"+basename+"."+JASPER;
        rapoarte.add(new Node(file.getPath(), path));
    }
    
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // Iterez prin noduri si le generez
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Iterator <Node> iterator = rapoarte.iterator();
    while (iterator.hasNext()) {
        Node node = iterator.next();
        try {
            System.out.println("COMPILING: "+node.sursa);
            JasperCompileManager.compileReportToFile(node.sursa, node.destinatie);
        } catch (JRException ex) {
            System.err.println("Could not compile "+node.sursa);
            ex.printStackTrace();
        }
    }

    //Inchei compilarea
    System.out.println("DONE");
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:36,代码来源:JCompileAllReportsByFolder.java

示例12: transform

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
public JasperDesign transform(String srcFileName) throws TransformException {

        String jasperFileName = Misc.changeFileExtension(srcFileName,"jasper");
        if ( ((CompileTransformerOptions)getComponent()).isDefaultDirectory())
        {
            File f = new File(jasperFileName);
              if (!IReportManager.getPreferences().getBoolean("useReportDirectoryToCompile", true))
              {
                 jasperFileName = IReportManager.getPreferences().get("reportDirectoryToCompile", ".");
                 if (!jasperFileName.endsWith(File.separator))
                 {
                        jasperFileName += File.separator;
                 }
                 jasperFileName += f.getName();
              }
        }
        
        if (((CompileTransformerOptions)getComponent()).isBackupJasper())
        {
            File oldJasper = new File(jasperFileName);
            if (oldJasper.exists())
            {
                oldJasper.renameTo(new File( Misc.changeFileExtension(srcFileName,"jrxml.bak")) );
            }
        }
        try {
            // Compile the report...
            JasperCompileManager.compileReportToFile(srcFileName, jasperFileName);
        } catch (JRException ex) {
            throw new TransformException(ex);
        }

        return null;
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:35,代码来源:CompileTransformer.java

示例13: exportResultFiles

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
/**
 * Export the result files and return a list of the compile filenames
 * 
 * @param result
 * @param directory
 * @param prefix
 * @return
 * @throws JRException
 */
public static List<String> exportResultFiles(BuildResult result, String directory, String prefix, boolean exportJrxml, boolean exportCompiled) throws JRException {
	File dir = new File(directory);
	if (dir.exists() == false && !dir.mkdirs()) {
		return null;
	}

	ArrayList<String> absFilenames = new ArrayList<>();
	for (int i = 0; i < result.designs.size(); i++) {
		JasperDesign design = result.designs.get(i);

		// update subreport reference to use the prefix. Do this on a deep copy of the design
		design = (JasperDesign) Serialization.deepCopy(design);
		JRDesignSection details = (JRDesignSection) design.getDetailSection();
		if (details != null) {
			for (JRBand band : details.getBandsList()) {
				JRDesignBand designBand = (JRDesignBand) band;
				for (JRElement element : designBand.getElements()) {
					if (JRDesignSubreport.class.isInstance(element)) {
						JRDesignSubreport sub = (JRDesignSubreport) element;
						JRDesignExpression expression = (JRDesignExpression) sub.getExpression();
						String newExpression = "\"" + prefix + expression.getText().replaceAll("\"", "") + "\"";
						expression.setText(newExpression);
					}
				}
			}
		}

		if (exportJrxml) {
			JRXmlWriter.writeReport(design, dir.getAbsolutePath() + File.separator + prefix + result.baseFilenames.get(i) + ".jrxml", "UTF-8");
		}

		if (exportCompiled) {
			String absFilename = dir.getAbsolutePath() + File.separator + prefix + result.baseFilenames.get(i) + ".jasper";
			JasperCompileManager.compileReportToFile(design, absFilename);
			absFilenames.add(absFilename);
		}
	}
	return absFilenames;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:49,代码来源:SubreportsWithProviderBuilder.java

示例14: setUp

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
@Before
public void setUp() throws JRException {
  outputDirectory = new File("target/reports");
  outputDirectory.mkdirs();
  JasperCompileManager.compileReportToFile(TEST_REPORT_SOURCE,
      TEST_REPORT_JASPER);
  reportPrint = JasperFillManager.fillReport(
      TEST_REPORT_JASPER, null, new JREmptyDataSource());
}
 
开发者ID:sourcepole,项目名称:jasperreports-wms-component,代码行数:10,代码来源:WmsMapElementRenderTest.java

示例15: service

import net.sf.jasperreports.engine.JasperCompileManager; //导入方法依赖的package包/类
@Override
public void service(
	HttpServletRequest request,
	HttpServletResponse response
	) throws IOException, ServletException
{
	ServletContext context = this.getServletConfig().getServletContext();

	response.setContentType("text/html");
	PrintWriter out = response.getWriter();

	try
	{
		JasperCompileManager.compileReportToFile(context.getRealPath("/reports/WebappReport.jrxml"));
	}
	catch (JRException e)
	{
		out.println("<html>");
		out.println("<head>");
		out.println("<title>JasperReports - Web Application Sample</title>");
		out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
		out.println("</head>");
		
		out.println("<body bgcolor=\"white\">");

		out.println("<span class=\"bnew\">JasperReports encountered this error :</span>");
		out.println("<pre>");

		e.printStackTrace(out);

		out.println("</pre>");

		out.println("</body>");
		out.println("</html>");

		return;
	}

	out.println("<html>");
	out.println("<head>");
	out.println("<title>JasperReports - Web Application Sample</title>");
	out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
	out.println("</head>");
	
	out.println("<body bgcolor=\"white\">");

	out.println("<span class=\"bold\">The JRXML report design was successfully compiled.</span>");

	out.println("</body>");
	out.println("</html>");
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:52,代码来源:CompileServlet.java


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