|
|
@@ -7,7 +7,6 @@ import com.crystaldecisions.sdk.occa.report.application.ReportSaveAsOptions;
|
|
|
import com.crystaldecisions.sdk.occa.report.data.IDatabase;
|
|
|
import com.crystaldecisions.sdk.occa.report.data.ITable;
|
|
|
import com.crystaldecisions.sdk.occa.report.data.Tables;
|
|
|
-import com.crystaldecisions.sdk.occa.report.document.ReportDocument;
|
|
|
import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -27,37 +26,6 @@ public class Application {
|
|
|
String reportName = "bjd_price.rpt";
|
|
|
client.setReportAppServer(ReportClientDocument.inprocConnectionString);
|
|
|
client.open(reportName, OpenReportOptions._retrieveNoReportDefinition);
|
|
|
-// IDatabase database = client.getDatabase();
|
|
|
-// Connections connections = database.getConnections();
|
|
|
-// for(int i =0 ;i < connections.size();i++){
|
|
|
-// IConnection iConnection = connections.get(i);
|
|
|
-// IConnection newConnection= (IConnection) iConnection.clone(false);
|
|
|
-// Tables tables = (Tables) newConnection.getTables().clone(true);
|
|
|
-// for(int j = 0;j<tables.size();j++){
|
|
|
-// ITable iTable = (ITable) tables.get(j).clone(true);
|
|
|
-// logger.info(iTable.getName());
|
|
|
-// iTable.setName("1_QUOTATION_VIEW");
|
|
|
-// logger.info(iTable.getName());
|
|
|
-// tables.remove(j);
|
|
|
-// tables.add(j, iTable);
|
|
|
-// }
|
|
|
-// newConnection.setTables(tables);
|
|
|
-// connections.removeConnection(iConnection);
|
|
|
-// connections.add(i, newConnection);
|
|
|
-// }
|
|
|
-// IDataDefinition dataDefinition = client.getDataDefinition();
|
|
|
-// Fields<IField> resultFields = dataDefinition.getResultFields();
|
|
|
-// client.getDataDefinition().getResultFields().remove(0);
|
|
|
-// System.out.println(resultFields.size());
|
|
|
-// Tables tables = (Tables) client.getDatabase().getTables().clone(true);
|
|
|
-// for (int j = 0; j < tables.size(); j++) {
|
|
|
-// ITable iTable = (ITable) tables.get(j).clone(true);
|
|
|
-// logger.info(iTable.getName());
|
|
|
-// iTable.setName("1_QUOTATION_VIEW");
|
|
|
-// logger.info(iTable.getName());
|
|
|
-// client.getDatabase().getTables().remove(j);
|
|
|
-// client.getDatabase().getTables().add(j, iTable);
|
|
|
-// }
|
|
|
|
|
|
DatabaseController databaseController = client.getDatabaseController();
|
|
|
IDatabase database = databaseController.getDatabase();
|
|
|
@@ -66,50 +34,11 @@ public class Application {
|
|
|
ITable iTable = (ITable) tables.get(j).clone(false);
|
|
|
logger.info(iTable.getName());
|
|
|
logger.info(iTable.getAlias());
|
|
|
-// iTable.setName("1_QUOTATION_VIEW");
|
|
|
-// iTable.setAlias("1_QUOTATION_VIEW");
|
|
|
-// logger.info(iTable.getName());
|
|
|
databaseController.modifyTableAlias(iTable, "1_QUOTATION_VIEW");
|
|
|
-// tables.set(j, iTable);
|
|
|
-// databaseController.getDatabase().getTables().remove(j);
|
|
|
-// databaseController.getDatabase().getTables().set(j, iTable);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// for (IConnection iConnection : connections) {
|
|
|
-// Tables tables = iConnection.getTables();
|
|
|
-// for (ITable iTable : tables) {
|
|
|
-// logger.info(iTable.getName());
|
|
|
-// iTable.setName("1_QUOTATION_VIEW");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// database.setConnections(null);
|
|
|
- System.out.println(client.isReadOnly());
|
|
|
-// client.refreshReportDocument();
|
|
|
-// client.save();
|
|
|
-// client.flushRequests();
|
|
|
client.saveAs(reportName, "C:\\sunyj\\project\\report-parent\\crystal-replace-view",
|
|
|
ReportSaveAsOptions._overwriteExisting);
|
|
|
- ReportDocument reportDocument=client.getReportDocument();
|
|
|
-
|
|
|
-// InputStream lis;
|
|
|
-// PrintOutputController lpoc;
|
|
|
-// lpoc = client.getPrintOutputController();
|
|
|
-// lis = lpoc.export(ReportExportFormat.from_int(ReportExportFormat._crystalReports));
|
|
|
-//
|
|
|
-// try {
|
|
|
-// FileOutputStream out = new FileOutputStream("C:\\sunyj\\project\\report-parent\\crystal-replace-view\\"+reportName);
|
|
|
-// byte[] buf = new byte[4096];
|
|
|
-// int len;
|
|
|
-// while ((len = lis.read(buf)) > 0) {
|
|
|
-// out.write(buf, 0, len);
|
|
|
-// }
|
|
|
-// out.close();
|
|
|
-// lis.close();
|
|
|
-// } catch (IOException e) {
|
|
|
-// System.err.println(e.toString());
|
|
|
-// }
|
|
|
-// reportDocument.save();
|
|
|
} catch (ReportSDKException e) {
|
|
|
logger.error("报表读取失败", e);
|
|
|
} catch (IOException e) {
|