Browse Source

删除exportReportToPdf、设置元素高度等不再使用的代码

sunyj 10 years ago
parent
commit
45f13d5a17

+ 0 - 6
src/main/java/com/uas/report/jasperreports/engine/export/CustomJRXlsExporter.java

@@ -56,12 +56,6 @@ public class CustomJRXlsExporter extends JRXlsExporter {
 
 	@Override
 	protected HSSFCellStyle getLoadedCellStyle(StyleInfo style) {
-		// if(style!=null){
-		// Field boxField=style.getClass().getField("box");
-		// boxField.setAccessible(true);
-		// BoxStyle box = new JRXlsExporter.StyleInfo.
-		// boxField.set(style, value);
-		// }
 		HSSFCellStyle cellStyle = super.getLoadedCellStyle(style);
 		if (customCellStyle) {
 			cellStyle.setBorderTop(CELL_BORDER);

+ 0 - 57
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -31,29 +31,20 @@ import com.uas.report.util.DataSourceUtils;
 import com.uas.report.util.FileUtils;
 import com.uas.report.util.ReportConstants;
 
-import net.sf.jasperreports.engine.JRBand;
-import net.sf.jasperreports.engine.JRElement;
 import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JRExporterParameter;
-import net.sf.jasperreports.engine.JRSection;
-import net.sf.jasperreports.engine.JRTextField;
 import net.sf.jasperreports.engine.JasperCompileManager;
-import net.sf.jasperreports.engine.JasperExportManager;
 import net.sf.jasperreports.engine.JasperFillManager;
 import net.sf.jasperreports.engine.JasperPrint;
 import net.sf.jasperreports.engine.JasperReport;
 import net.sf.jasperreports.engine.design.JasperDesign;
 import net.sf.jasperreports.engine.export.JRPdfExporter;
 import net.sf.jasperreports.engine.export.JRXlsExporter;
-import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
 import net.sf.jasperreports.engine.xml.JRXmlLoader;
 import net.sf.jasperreports.export.ExporterInput;
 import net.sf.jasperreports.export.OutputStreamExporterOutput;
 import net.sf.jasperreports.export.SimpleExporterInput;
 import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
 import net.sf.jasperreports.export.SimplePdfReportConfiguration;
-import net.sf.jasperreports.export.SimpleXlsExporterConfiguration;
-import net.sf.jasperreports.export.XlsExporterConfiguration;
 
 /**
  * 报表打印
@@ -290,39 +281,6 @@ public class PrintServiceImpl implements PrintService {
 		return jasperFilePath;
 	}
 
-	/**
-	 * 以不同的格式导出报表
-	 * 
-	 * @param jasperPrint
-	 * @param exportFileType
-	 * @param outputStream
-	 */
-	// private void exportReport(JasperPrint jasperPrint, String exportFileType,
-	// OutputStream outputStream) {
-	// try {
-	// if (exportFileType.equals("pdf")) {
-	// exportReportToPdf(jasperPrint, outputStream);
-	// } else if (exportFileType.equals("xls")) {
-	// exportReportToXls(jasperPrint, outputStream);
-	// } else {
-	// throw new ReportException("不支持导出为 " + exportFileType + "格式!");
-	// }
-	// } catch (JRException e) {
-	// throw new ReportException(e).setDetailedMessage(e);
-	// }
-	// }
-
-	/**
-	 * 以pdf的格式导出报表
-	 * 
-	 * @param jasperPrint
-	 * @param outputStream
-	 * @throws JRException
-	 */
-	private void exportReportToPdf(JasperPrint jasperPrint, OutputStream outputStream) throws JRException {
-		JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
-	}
-
 	/**
 	 * 以xls的格式导出报表
 	 * 
@@ -333,12 +291,6 @@ public class PrintServiceImpl implements PrintService {
 	private void exportReportToXls(JasperPrint jasperPrint, OutputStream outputStream, boolean customCellStyle)
 			throws JRException {
 		JRXlsExporter exporter = new CustomJRXlsExporter(customCellStyle);
-		// SimpleXlsExporterConfiguration configuration = new
-		// SimpleXlsExporterConfiguration();
-		// configuration.setCreateCustomPalette(true);
-		// configuration.setKeepWorkbookTemplateSheets(true);
-		// configuration.setOverrideHints(true);
-		// exporter.setConfiguration(configuration);
 		ExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
 		exporter.setExporterInput(exporterInput);
 		OutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(outputStream);
@@ -373,15 +325,6 @@ public class PrintServiceImpl implements PrintService {
 		jasperDesign.setLeftMargin(0);
 		jasperDesign.setBottomMargin(0);
 		jasperDesign.setRightMargin(0);
-
-		// 设置DetailBand中的元素高度不动态调整
-		// JRSection detailSection = jasperDesign.getDetailSection();
-		// JRBand[] bands = detailSection.getBands();
-		// JRElement[] elements = bands[0].getElements();
-		// for (JRElement element : elements) {
-		// JRTextField textField = (JRTextField) element;
-		// textField.setStretchWithOverflow(false);
-		// }
 	}
 
 	@Override