帳票システム構築支援 uCosminexus EUR uCosminexus EUR サーバ帳票出力
帳票をプリンタ出力するコーディング例を次に示します。
import JP.co.Hitachi.soft.EURPS.*;
:
try {
EURPSManager obj=new EURPSManager();
/********** 1. 配列定義領域 開始 **********/
String fms[]=new String[3];
String dbv[]=new String[3];
//接続情報ファイル名をdbiに設定
String dbi="DBInfo1.txt";
//帳票ファイル名を配列fmsに設定
fms[0]="sample1.fms";
fms[1]="sample2.fms";
fms[2]="sample3.fms";
//可変記号値定義ファイル名を配列dbvに設定
dbv[0]="DBVar1.txt";
dbv[1]="DBVar2.txt";
dbv[2]="DBVar3.txt";
/********** 1. 配列定義領域 終了 **********/
/********** 2. ファイル名指定領域 開始 **********/
//印刷種別を「0(プリンタ出力)」に指定
obj.setOutputType(0);
//出力するプリンタ名の指定
obj.setPrinterName("Printer1");
//接続情報ファイル名の指定
obj.setDBInfoFileName(dbi);
//帳票ファイル名の指定
obj.setMultiReportFileName(fms);
//可変記号値定義ファイル名の指定
obj.setMultiDataFileName(dbv);
/********** 2. ファイル名指定領域 終了 **********/
//帳票の出力指示
obj.printReport();
}
//エラー処理
catch (EURPSException ce) {
String erridstr;
int errid = 0;
if (ce.getMessage()!= null && ce.getMessage().length() >= 8) {
erridstr = ce.getMessage().substring(4, 7);
//メッセージIDをerridに取り出す
errid = Integer.parseInt(erridstr);
}
/********** 3. エラー番号指定領域 開始 **********/
if (errid==300) {
//KEEU300-Wの場合のエラー処理
} else if (errid==5) {
//KEEU005-Eの場合のエラー処理
} else if (errid==53) {
//KEEU053-Eの場合のエラー処理
}
/********** 3. エラー番号指定領域 終了 **********/
}
そのほかの場合は,「1.配列定義領域」,「2.ファイル名指定領域」,「3.エラー番号指定領域」のそれぞれに,次に示すコーディング例を当てはめて使用してください。
| //印刷種別を「0(プリンタ出力)」に指定 obj.setOutputType(0); //出力するプリンタ名の指定 obj.setPrinterName("Printer1"); //帳票ファイル名の指定 obj.setReportFileName("sample1.fms"); //マッピングデータファイル名の指定 obj.setDataFileName("mapping1.csv"); |
| if (errid==300) { //KEEU300-Wの場合のエラー処理 } else if (errid==5) { //KEEU005-Eの場合のエラー処理 } else if (errid==6) { //KEEU006-Eの場合のエラー処理 } |
| //印刷種別を「0(プリンタ出力)」に指定 obj.setOutputType(0); //出力するプリンタ名の指定 obj.setPrinterName("Printer1"); //接続情報ファイル名の指定 obj.setDBInfoFileName("DBInfo1.txt"); //帳票ファイル名の指定 obj.setReportFileName("sample1.fms"); //可変記号値定義ファイル名の指定 obj.setDataFileName("DBVar1.txt"); |
| if (errid==300) { //KEEU300-Wの場合のエラー処理 } else if (errid==5) { //KEEU005-Eの場合のエラー処理 } else if (errid==53) { //KEEU053-Eの場合のエラー処理 } |
| String fms[]=new String[3]; String map[]=new String[3]; //帳票ファイル名を配列fmsに設定 fms[0]="sample1.fms"; fms[1]="sample2.fms"; fms[2]="sample3.fms"; //マッピングデータファイル名を配列mapに設定 map[0]="mapping1.csv"; map[1]="mapping2.csv"; map[2]="mapping3.csv"; |
| //印刷種別を「0(プリンタ出力)」に指定 obj.setOutputType(0); //出力するプリンタ名の指定 obj.setPrinterName("Printer1"); //帳票ファイル名の指定 obj.setMultiReportFileName(fms); //マッピングデータファイル名の指定 obj.setMultiDataFileName(map); |
| if (errid==300) { //KEEU300-Wの場合のエラー処理 } else if (errid==5) { //KEEU005-Eの場合のエラー処理 } else if (errid==6) { //KEEU006-Eの場合のエラー処理 } |
| //印刷種別を「0(プリンタ出力)」に指定 obj.setOutputType(0); //出力するプリンタ名の指定 obj.setPrinterName("Printer1"); //複数様式情報定義ファイル名の指定 obj.setMultiFormInfoDefFileName("formdef.txt"); //帳票セット指定ファイル名の指定 obj.setMultiReportSetFileName("formset.txt"); |
| if (errid==300) { //KEEU300-Wの場合のエラー処理 } else if (errid==35) { //KEEU035-Eの場合のエラー処理 } else if (errid==37) { //KEEU037-Eの場合のエラー処理 } |
| //印刷種別を「0(プリンタ出力)」に指定 obj.setOutputType(0); //出力するプリンタ名の指定 obj.setPrinterName("Printer1"); //複数様式情報定義ファイル名の指定 obj.setMultiFormInfoDefFileName("formdef.txt"); //接続情報ファイル名の指定 obj.setDBInfoFileName("DBInfo1.txt"); //帳票セット指定ファイル名の指定 obj.setMultiReportSetFileName("formset.txt"); |
| if (errid==300) { //KEEU300-Wの場合のエラー処理 } else if (errid==35) { //KEEU035-Eの場合のエラー処理 } else if (errid==37) { //KEEU037-Eの場合のエラー処理 } else if (errid==53) { //KEEU053-Eの場合のエラー処理 } |
All Rights Reserved. Copyright (C) 2008, 2011, Hitachi, Ltd.