这是delphi写的,老板要求转化成JAVA代码,可怜我,对JAVA一点都不懂,请各位高人,出手相助.

ZXYSOSO 2009-10-26 11:07:10
老板要求我把此段Delphi写的代码转化成JAVA代码,但我没有学过JAVA,这几天在了解JAVA,感觉头到大啦,而且快到评年终绩效啦,今年感觉绩效会评得不好,当然也不会排除被炒的

可能,我只希望上周老板交待的代码转换,至少能够做成80%左右,就应该有一个交待啦,不然,总是有一把剑在头上悬着,随时,都会掉下来砍头,打工就是难啊.如果那位高人能够帮忙

把此代码转化成JAVA,我可以给点小钱作为辛苦的补偿(50元),这一点,请班主谅解,当然,也不会有很多.老婆的预产期在11月中,很想回家陪老婆,站老婆生小陔安心些,但工作做得如

此艰难,又不敢请多几天假,一言难尽...

里面有一些方法,是DELPHI写的,因为不管它,直接在JAVA使用就行啦,转化成JAVA代码不需要能够运行,因为也运行不了,能够完成80%,就可以啦.
unit DpPressNew;
interface
uses
Classes, SysUtils, StrUtils, DB, ComObj, Variants
const
UNIT_NAME = 'DpPressNew';
CST_MACRO_LEFT_MARK = '<';
CST_MACRO_RIGHT_MARK = '>';
CST_MACRO_KEY_MARK = '$';
CST_MAX_PAGES = 1000000;
CST_MAX_LAYOUT_ROWS = 3;
CST_MAX_LAYOUT_COLS = 3;
CST_MAX_COL_MARGIN = 400;
CST_MAX_ROW_MARGIN = 50;
CST_MAX_TEMPLATE_ROWS = 80;
CST_MAX_TEMPLATE_COLS = 50;
CST_KEY_MAIN = 'MAIN';
CST_KEY_LAYOUT = 'LAYOUT';
CST_KEY_LAYOUT_ROWS = 'LAYOUT ROWS';
CST_KEY_LAYOUT_COLS = 'LAYOUT COLS';
CST_KEY_DIV_BY_ROW = 'DIV BY ROW';
CST_KEY_TEMPLATE = 'TEMPLATE';
CST_KEY_TEMPLATE_ROWS = 'TEMPLATE ROWS';
CST_KEY_TEMPLATE_COLS = 'TEMPLATE COLS';
CST_KEY_MARGIN = 'MARGIN';
CST_KEY_MARGIN_ROW = 'ROW MARGIN';
CST_KEY_MARGIN_COL = 'COLUMN MARGIN';
CST_KEY_AREA = 'AREA';
CST_KEY_AREA_ROW_FROM = 'ROW FROM';
CST_KEY_AREA_ROW_TO = 'ROW TO';
CST_KEY_AREA_COL_FROM = 'COLUMN FROM';
CST_KEY_AREA_COL_TO = 'COLUMN TO';
CST_KEY_AREA_ROW_BY_ROW = 'ROW BY ROW';
CST_KEY_SQL = 'SQL';
CST_KEY_CELLS = 'CELLS';
CST_SHEET_SETTING = 'SETTING';
CST_SHEET_PARAMETER = 'PARAMETER';
CST_SHEET_TEMPLATE = 'TEMPLATE';
CST_SHEET_LOG = 'LOGS';
CST_COL_INDEX = 1;
CST_COL_KEY_LEVEL1 = 2;
CST_COL_KEY_LEVEL2 = 3;
CST_COL_DESCRIPTION = 4;
CST_COL_PARA_VALUE = 5;
type
TDpEventNewPage = procedure(iPage, iTotalPage: Integer
; var lCanceled: Boolean) of object;
iPressData = interface
['{64C3BDEB-6D34-45E8-BC5A-2202B88DD379}']
function _GetEof: Boolean;
function _GetCount: Integer;
function _GetSqlParaCount: Integer;
function _GetErrCode: LongInt;
function _GetErrMess: string;
function AssignSql(cSql: string): Boolean;
function GetSql: string;
function AssignSqlPara(cPara: string; cValue: string): Boolean;
function GetSqlParaKey(iIndex: Integer): string;
function GetSqlParaValue(iIndex: Integer): string;
function ReadData: Boolean;
function Macro(cKey: string; oParas: TStringList): WideString;
property Eof: Boolean read _GetEof;
property Count: Integer read _GetCount;
property SqlParaCount: Integer read _GetSqlParaCount;
property ErrCode: LongInt read _GetErrCode;
property ErrMess: string read _GetErrMess;
procedure MoveRecords(iStep: Integer);
end;

iPresswork = interface
['{F78268D7-329D-450F-A37D-7BFE8517C5C4}']
function _GetID: string;
function _GetType: string;
function _GetErrMess: string;
function _GetErrCode: LongInt;
function _GetCopyNum: Integer;
function _GetPrinter: TDpSfcPrinter;
function _GetPageTo: Integer;
function _GetPageFrom: Integer;
function _GetPressData: iPressData;
function _GetPressDataObj: TDpInterfaceObj;
procedure _SetID(cID: string);
procedure _SetType(cType: string);
procedure _SetPrinter(oPrinter: TDpSfcPrinter);
procedure _SetPressDataObj(oData: TDpInterfaceObj);
procedure _SetCopyNum(iCopyNum: Integer);
procedure _SetOnNewPage(pOnNewPage: TDpEventNewPage);
procedure _SetAutoPrint(lValue: Boolean);
procedure _SetFastPrint(lValue: Boolean);
procedure _SetPageTo(iTo: Integer);
procedure _SetPageFrom(iFrom: Integer);
property ID: string read _GetID write _SetID;
property ErrCode: LongInt read _GetErrCode;
property ErrMess: string read _GetErrMess;
property CopyNum: Integer read _GetCopyNum write _SetCopyNum;
property AutoPrint: Boolean write _SetAutoPrint;
property FastPrint: Boolean write _SetFastPrint;
property PressData: iPressData read _GetPressData;
property PressDataObj: TDpInterfaceObj read _GetPressDataObj;
property Printer: TDpSfcPrinter read _GetPrinter write _SetPrinter;
property OnNewPage: TDpEventNewPage write _SetOnNewPage;
property MyType: string read _GetType write _SetType;
property PageFrom: Integer read _GetPageFrom write _SetPageFrom;
property PageTo: Integer read _GetPageTo write _SetPageTo;
function InitMe(cFile: string; adoCnt: TDpAdoConnect): Boolean;
function Generate: Boolean;
function Print: Boolean;
procedure SetMarginLeft(iMarginLeft: Integer);
procedure SetMarginTop(iMarginTop: Integer);
end;
...全文
182 19 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjfjebj789 2009-11-02
  • 打赏
  • 举报
回复
不能运行,根本就不知道是用来做什么的,也不好调试,咋改?
fansy007 2009-11-02
  • 打赏
  • 举报
回复
哎,要是不知道这代码干啥的,叫人改,真要让人发疯。

我觉得,怎么改是小事,调通DELPHI代码,看看他究竟干了啥,才是最麻烦的。
同情你。
岁月之梦 2009-11-02
  • 打赏
  • 举报
回复
写一个算了!
Ostroff 2009-10-27
  • 打赏
  • 举报
回复
也不会啊,可惜了了
老张-AI 2009-10-27
  • 打赏
  • 举报
回复
帮你顶顶

不会delphi
老张-AI 2009-10-27
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 zxysoso 的回复:]
大家看到我的头像吗?这就是我的卧室,家里一穷二白,四僻石砖.
[/Quote]

、。。。。全是砖啊
studying_ 2009-10-27
  • 打赏
  • 举报
回复
给楼主顶起来先。希望你的问题能早日解决撒。工作和家庭都要兼顾呀。深有同感。
ZXYSOSO 2009-10-27
  • 打赏
  • 举报
回复
大家看到我的头像吗?这就是我的卧室,家里一穷二白,四僻石砖.
ZXYSOSO 2009-10-27
  • 打赏
  • 举报
回复
大家好,虽然没有得到大家的切底帮忙,但我也是十分感激啦,

我只会delphi和c#,主管说,JAVA与C#的语法差不多,让我把这段代码翻译成JAVA,

但我根本上没有学习过JAVA,所以这几天睡吃不安,

今天早上,主管问我,搞得怎样,我说,JAVA不了解,装了JB了解一下,主管,就叫我用

C#翻译,就得啦,我稍为松了一口气啦.

不过,今天下午用C#搞了一些,也不乐观,进度好慢,代码要一点点地输入,毕竟delphi与

C#的语言有点不一样,所以说,痛苦减少啦,但还是存在,

没有办法啦,只有把现在手上的工作都放在一边,全力搞这件事.希望能过关.
swandragon 2009-10-27
  • 打赏
  • 举报
回复
感觉写一个比看这个改要快
zjx2388 2009-10-27
  • 打赏
  • 举报
回复
你这主要实现一个什么功能?

或许咋们用JAVA的人帮你实现一个还会快点

littlemonster 2009-10-27
  • 打赏
  • 举报
回复
听说Delphi做swing很爽呀?。。
  • 打赏
  • 举报
回复
好多函数和过程声明啊
fishrui 2009-10-27
  • 打赏
  • 举报
回复
[Quote]
iPressData = interface
['{64C3BDEB-6D34-45E8-BC5A-2202B88DD379}']
function _GetEof: Boolean;
function _GetCount: Integer;
function _GetSqlParaCount: Integer;
function _GetErrCode: LongInt;
function _GetErrMess: string;
function AssignSql(cSql: string): Boolean;
function GetSql: string;
function AssignSqlPara(cPara: string; cValue: string): Boolean;
function GetSqlParaKey(iIndex: Integer): string;
function GetSqlParaValue(iIndex: Integer): string;
function ReadData: Boolean;
function Macro(cKey: string; oParas: TStringList): WideString;
property Eof: Boolean read _GetEof;
property Count: Integer read _GetCount;
property SqlParaCount: Integer read _GetSqlParaCount;
property ErrCode: LongInt read _GetErrCode;
property ErrMess: string read _GetErrMess;
procedure MoveRecords(iStep: Integer);
end;
[/Quote]
接口定义:
public interface IPressData {
public final static Boolean Eof=false;
public final static Integer Count=0;
public final static Integer SqlParaCount=0;
public final static Long ErrCode=0;
public final static String ErrMess="";

Boolean _GetEof();
Integer _GetCount();
Integer _GetSqlParaCount();
Long _GetErrCode();
String _GetErrMess();

Boolean AssignSql(cSql: string);
String GetSql();
Boolean AssignSqlPara(cPara: string; cValue: string);
String GetSqlParaKey(iIndex: Integer);
String GetSqlParaValue(iIndex: Integer);
Boolean ReadData();
String Macro(cKey: string; oParas: TStringList);
void MoveRecords(iStep: Integer);
}

fishrui 2009-10-27
  • 打赏
  • 举报
回复
[Quote]
TDpEventNewPage = procedure(iPage, iTotalPage: Integer
; var lCanceled: Boolean) of object;
[/Quote]

过程类型貌似Java中没有这种语法。
fishrui 2009-10-27
  • 打赏
  • 举报
回复
[Quote]
const
  UNIT_NAME = 'DpPressNew';
  CST_MACRO_LEFT_MARK = ' <';
  CST_MACRO_RIGHT_MARK = '>';
  CST_MACRO_KEY_MARK = '$';
  CST_MAX_PAGES          = 1000000;
  CST_MAX_LAYOUT_ROWS    = 3;
  CST_MAX_LAYOUT_COLS    = 3;
  CST_MAX_COL_MARGIN      = 400;
  CST_MAX_ROW_MARGIN      = 50;
  CST_MAX_TEMPLATE_ROWS  = 80;
  CST_MAX_TEMPLATE_COLS  = 50;
  CST_KEY_MAIN            = 'MAIN';
  CST_KEY_LAYOUT          = 'LAYOUT';
  CST_KEY_LAYOUT_ROWS    = 'LAYOUT ROWS';
  CST_KEY_LAYOUT_COLS    = 'LAYOUT COLS';
  CST_KEY_DIV_BY_ROW      = 'DIV BY ROW';
  CST_KEY_TEMPLATE        = 'TEMPLATE';
  CST_KEY_TEMPLATE_ROWS  = 'TEMPLATE ROWS';
  CST_KEY_TEMPLATE_COLS  = 'TEMPLATE COLS';
  CST_KEY_MARGIN          = 'MARGIN';
  CST_KEY_MARGIN_ROW      = 'ROW MARGIN';
  CST_KEY_MARGIN_COL      = 'COLUMN MARGIN';
  CST_KEY_AREA            = 'AREA';
  CST_KEY_AREA_ROW_FROM  = 'ROW FROM';
  CST_KEY_AREA_ROW_TO    = 'ROW TO';
  CST_KEY_AREA_COL_FROM  = 'COLUMN FROM';
  CST_KEY_AREA_COL_TO    = 'COLUMN TO';
  CST_KEY_AREA_ROW_BY_ROW = 'ROW BY ROW';
  CST_KEY_SQL            = 'SQL';
  CST_KEY_CELLS          = 'CELLS';
  CST_SHEET_SETTING      = 'SETTING';
  CST_SHEET_PARAMETER    = 'PARAMETER';
  CST_SHEET_TEMPLATE      = 'TEMPLATE';
  CST_SHEET_LOG          = 'LOGS';
  CST_COL_INDEX          = 1;
  CST_COL_KEY_LEVEL1      = 2;
  CST_COL_KEY_LEVEL2      = 3;
  CST_COL_DESCRIPTION    = 4;
  CST_COL_PARA_VALUE      = 5;
[/Quote]

Delphi是以单元文件组织代码的,而Java是以类文件组织的,所以要拆分的
常量定义:
public class ConstVar{
public static final UNIT_NAME = 'DpPressNew';
public static final CST_MACRO_LEFT_MARK = ' <';
public static final CST_MACRO_RIGHT_MARK = '>';
public static final CST_MACRO_KEY_MARK = '$';
。。。
}

ZXYSOSO 2009-10-26
  • 打赏
  • 举报
回复
{ TDpMacro }

procedure TDpMacro.LinkData(iiData: iPressData);
begin
_iiData := iiData;
end;

//Replace Double Quotation Marks
function TDpMacro._ReplaceDQuo(cText: string): string;
var
cTmp: string;
iPos: Integer;
iPosL: Integer;
iQuoDiff: Integer;
begin
Result := cText;

iPos := Pos('"', cText);
iPosL := 0;
iQuoDiff := 0;
while iPos > 0 do begin
iQuoDiff := iQuoDiff + 1;
if iQuoDiff mod 2 = 0 then begin
cTmp := StrMid(Result, iPosL, iPos - iPosL + 1);
Result := StrLeft(Result, iPosL - 1)
+ Duplicate('*', Length(cTmp))
+ StrMid(Result, iPos + 1)
;

iPos := Pos('"', Result);
end else begin
iPosL := iPos;
iPos := PosEx('"', Result, iPos + 1);
end;
end;
end;

function TDpMacro._DelSurroundQuo(cText: string): string;
var
iPos1: Integer;
iPos2: Integer;
begin
Result := '';

if cText <> '' then begin
if SurroundBy(cText, '"') then begin
Result := Trim(cText);
Result := StrMid(Result, 2, Length(Result) - 2);
end else begin
iPos1 := Pos('"', cText);
while iPos1 > 0 do begin
iPos2 := PosEx('"', cText, iPos1 + 1);
if iPos2 > 0 then begin
Result := Result
+ StrLeft(cText, iPos1 - 1)
+ StrMid(cText, iPos1 + 1, iPos2 - iPos1 - 1)
;
cText := StrMid(cText, iPos2 + 1);
iPos1 := Pos('"', cText);
end else begin
Break;
end;
end;
Result := Result + cText;
end;
end;
end;


//把计 cText琌埃'<'㎝'>'场だ => $F(XXX)
function TDpMacro.Resolve(cText: string; lNoMacroMark: Boolean): WideString;
function __GetMacroPart(cText: string; var iPos1, iPos2: Integer): string;
begin
Result := GetMacroPart(_ReplaceDQuo(cText), CST_MACRO_LEFT_MARK, CST_MACRO_RIGHT_MARK, iPos1, iPos2);
end;

var
iPos1: Integer;
iPos2: Integer;
iLmLen: Integer;
iRmLen: Integer;
begin
Result := '';

if SurroundBy(cText, '"') then begin
Result := _DelSurroundQuo(cText);
end else begin
iLmLen := Length(CST_MACRO_LEFT_MARK);
iRmLen := Length(CST_MACRO_RIGHT_MARK);
while __GetMacroPart(cText, iPos1, iPos2) <> '' do begin
Result := Result
+ _DelSurroundQuo(StrLeft(cText, iPos1 - iLmLen - 1))
+ _ResolveCore(StrMid(cText, iPos1, iPos2 - iPos1 + 1))
;
cText := StrMid(cText, iPos2 + iRmLen + 1);
end;
end;

Result := Result + _DelSurroundQuo(cText);
end;

function TDpMacro._ResolveCore(cText: string): WideString;
function __FirstMacroPos(cText: string; var iPos1: Integer; var iPos2: Integer): Boolean;
var
iPos: Integer;
begin
Result := False;
iPos := Pos(CST_MACRO_KEY_MARK, cText);
if iPos > 0 then begin
iPos1 := iPos;

iPos := PosEx('(', cText, iPos + 1);
if iPos > 0 then begin
if GetCorrMacroPart(cText, '(', ')', iPos, iPos2)then begin
Result := True;
end else begin
SfcE.Err(E_DP_PRESSWORK_BAD_MACRO
, UNIT_NAME + '.TDpMacro._ResolveCore(cText: string)'
, Cap(CAP_THE_CONTENT_OF_TEMPLATE_ERROR) + '(' + Cap(CAP_MAYBE_BRACKET_UNMATCH) + '): ' + cText
);
end;
end else begin
iPos2 := Length(cText);
Result := True;
end;
end;
end;
var
iPos1: Integer;
iPos2: Integer;
begin
Result := '';

while __FirstMacroPos(cText, iPos1, iPos2) do begin
Result := _DelSurroundQuo(StrLeft(cText, iPos1 - 1))
+ _ResolveCoreDeep(StrMid(cText, iPos1, iPos2 - iPos1 + 1))
;
cText := StrMid(cText, iPos2 + 1);
end;

Result := Result + _DelSurroundQuo(cText);
end;

function TDpMacro._ResolveCoreDeep(cText: string): WideString;
//MacroいKey & Paras
function __DivideInfo(cText: string
; var cKey: string
; var cParas: string): Boolean;
var
iPos: Integer;
begin
Result := False;

cKey := '';
cParas := '';

cText := Trim(cText);
if StrLeft(cText, Length(CST_MACRO_KEY_MARK)) = CST_MACRO_KEY_MARK then begin
cText := StrMid(cText, Length(CST_MACRO_KEY_MARK) + 1);
iPos := Pos('(', cText);
if iPos > 0 then begin
cKey := UpperCase(Trim(StrLeft(cText, iPos - 1)));
cText := Trim(StrMid(cText, iPos));
if (StrLeft(cText, 1) = '(') and (StrRight(cText, 1) = ')') then begin
cParas := Trim(StrMid(cText, 2, Length(cText) - 2));
Result := True;
end;
end else begin
cKey := UpperCase(Trim(cText));
//cText := '';
Result := True;
end;
end;
end;

function __GetParaRightPos(cParas: WideString): Integer;
var
cTmp: string;
iPos: Integer;
iPosL: Integer;
iPosR: Integer;
begin
Result := 0;

cParas := Trim(cParas);
if Length(cParas) = 0 then begin
Exit;
end;
cParas := _ReplaceDQuo(cParas);

iPos := Pos(',', cParas);
if iPos = 0 then begin
Result := Length(cParas);
end else begin
cTmp := cParas;
if Pos('(', cParas) <= 0 then begin
Result := iPos - 1;
end else if Pos('(', cParas) > iPos then begin
Result := iPos - 1;
end else begin
if GetCorrMacroPart(cTmp, '(', ')', iPosL, iPosR) then begin
iPos := iPosR;
iPos := iPos + __GetParaRightPos(StrMid(cParas, iPos + 1));
Result := iPos;
end;
end;
end;
end;

function __ExtractParas(cParas: string): TStringList;
var
iPos: Integer;
cTmp: string;
begin
Result := TStringList.Create;
iPos := __GetParaRightPos(cParas);
while iPos > 0 do begin
cTmp := Trim(StrLeft(cParas, iPos));
Result.Add(cTmp);

cParas := Trim(StrMid(cParas, iPos + 1));
if StrLeft(cParas, 1) = ',' then begin
cParas := Trim(StrMid(cParas, 2));
end;
iPos := __GetParaRightPos(cParas);
end;
end;

var
i: Integer;
cTmp: string;
cKey: string;
cParas: string;
oParaList: TStringList;
begin
Result := '';

if __DivideInfo(cText, cKey, cParas) then begin
oParaList := __ExtractParas(cParas);
for i := 0 to oParaList.Count - 1 do begin
cTmp := oParaList[i];
if Pos(CST_MACRO_KEY_MARK, cTmp) > 0 then begin
oParaList[i] := _ResolveCore(oParaList[i]);
end else if SurroundBy(cTmp, '"') then begin
cTmp := Trim(cTmp);
cTmp := StrMid(cTmp, 2, Length(cTmp) - 2);
oParaList[i] := cTmp;
end;
end;
Result := _iiData.Macro(cKey, oParaList);
oParaList.Free;
end;
end;
ZXYSOSO 2009-10-26
  • 打赏
  • 举报
回复
TDpPressExcelBase = class(TMzyExcel)
private
{i} _cID: string;
_cSql: string;
_cType: string;
_cErrMess: string;
_iErrCode: LongInt;
_iCopyNum: Integer;
_lAutoPrint: Boolean;
_lFastPrint: Boolean;

_FMaxRow: Integer;
_FMaxCol: Integer;
_FDivByRow: Boolean;
_FColMargin: Integer;
_FRowMargin: Integer;
_FTemplateRows: Integer;
_FTemplateCols: Integer;
_FLayoutRows: Integer;
_FLayoutCols: Integer;
_FTemplateFile: string;
_iPageFrom: Integer;
_iPageTo: Integer;
_FRange: TDpExcelRange;
_FAdoCnt: TDpAdoConnect;
_FArea: TDpPressExcelArea;
_FAreaList: TDpList;
_FMacroCells: TDpList;
_oPrinter: TDpSfcPrinter;
function _GetID: string;
function _GetType: string;
function _GetCopyNum: Integer;
function _GetPrinter: TDpSfcPrinter;
function _GetPageFrom: Integer;
function _GetPageTo: Integer;
function _GetErrCode: LongInt;
function _GetErrMess: string;
procedure _SetID(cID: string);
procedure _SetPrinter(oPrinter: TDpSfcPrinter);
procedure _SetCopyNum(iCopyNum: Integer);
procedure _SetAutoPrint(lAutoPrint: Boolean);
procedure _SetType(cType: string);
procedure _SetPageFrom(iPageFrom: Integer);
procedure _SetPageTo(iPageTo: Integer);
procedure _SetFastPrint(lFastPrint: Boolean);
public
constructor Create; override;
destructor Destroy; override;
property ID: string read _GetID write _SetID;
property CopyNum: Integer read _GetCopyNum write _SetCopyNum;
property Printer: TDpSfcPrinter read _GetPrinter write _SetPrinter;
property AutoPrint: Boolean write _SetAutoPrint;
property SQL: string read _cSql write _cSql;
property DivByRow: Boolean read _FDivByRow write _FDivByRow;
property TemplateRows: Integer read _FTemplateRows write _FTemplateRows;
property TemplateCols: Integer read _FTemplateCols write _FTemplateCols;
property LayoutRows: Integer read _FLayoutRows write _FLayoutRows;
property LayoutCols: Integer read _FLayoutCols write _FLayoutCols;
property ColMargin: Integer read _FColMargin write _FColMargin;
property RowMargin: Integer read _FRowMargin write _FRowMargin;
property MaxRow: Integer read _FMaxRow write _FMaxRow;
property MaxCol: Integer read _FMaxCol write _FMaxCol;
property Range: TDpExcelRange read _FRange write _FRange;
property PageFrom: Integer read _GetPageFrom write _SetPageFrom;
property PageTo: Integer read _GetPageTo write _SetPageTo;
property MyType: string read _GetType write _SetType;
property FastPrint: Boolean write _SetFastPrint;
property ErrCode: LongInt read _GetErrCode;
property ErrMess: string read _GetErrMess;

function InitMe(cFile: string; adoCnt: TDpAdoConnect): Boolean; overload; virtual;
function Verify: Boolean;
function AddSettingSheet: Boolean;
function AutoAddParaSheet: Boolean;
end;

TDpPressExcel = class(TDpPressExcelBase, iPresswork)
private
_FFillArea: Boolean; //True タ恶Area
_FRowOffset: Integer;
_FColOffset: Integer;
_FOnNewPage: TDpEventNewPage;
_oMacro: TDpMacro;
_iiPressData: iPressData;
_oPressDataObj: TDpInterfaceObj;

_lNewSubPage: Boolean; //琌タ陆腑
function _LoadPara: Boolean;
function _GetPressData: iPressData;
function _GetPressDataObj: TDpInterfaceObj;
procedure _FillArea;
procedure _FillParts(oMacroCells: TDpList; lArea: Boolean = False); //恶–眎Travell card;
procedure _SetActiveRange(iIndex: Integer); //砞﹚–眎Travell card RowCol絛瞅
procedure _ClearNotUsed(iBegin: Integer);
procedure _CopyTemplateFast;
procedure _SetPressDataObj(oData: TDpInterfaceObj);
procedure _SetOnNewPage(pOnNewPage: TDpEventNewPage);
public
constructor Create; override;
destructor Destroy; override;

property OnNewPage: TDpEventNewPage write _SetOnNewPage;
property PressData: iPressData read _GetPressData;
property PressDataObj: TDpInterfaceObj read _GetPressDataObj write _SetPressDataObj;

function InitMe(cFile: string; adoCnt: TDpAdoConnect): Boolean; override;
function Generate: Boolean; overload;
function Print: Boolean;
procedure SetMarginLeft(iMarginLeft: Integer);
procedure SetMarginTop(iMarginTop: Integer);
end;

implementation
ZXYSOSO 2009-10-26
  • 打赏
  • 举报
回复
TDpMacro = class(TDpObject)
private
_iiData: iPressData;
function _ReplaceDQuo(cText: string): string;
function _DelSurroundQuo(cText: string): string;
function _ResolveCore(cText: string): WideString;
function _ResolveCoreDeep(cText: string): WideString;
public
function Resolve(cText: string; lNoMacroMark: Boolean = False): WideString;
procedure LinkData(iiData: iPressData);
end;

TDpPressDataBase = class(TDpInterfaceObj, iPressData)
private
_FSql: string;
_cErrMess: string;
_FCount: Integer;
_iErrCode: LongInt;
_FAdoQry: TDpAdoQuery;
_FAdoCnt: TDpAdoConnect;
_FParaList: TDpKeyValueList;
_lNewPage: Boolean;
_iPage: Integer;
_iSubPage: Integer;
function _GetEof: Boolean;
function _GetCount: Integer;
function _GetSqlParaCount: Integer;
function _GetQuery: TDpAdoQuery;
function _GetErrCode: LongInt;
function _GetErrMess: string;
procedure _SetCount(iCount: Integer);
public
constructor Create; override;
destructor Destroy; override;
function InitMe(adoCnt: TDpAdoConnect): Boolean;
function AssignSql(cSql: string): Boolean;
function AssignSqlPara(cPara: string; cValue: string): Boolean;
function ReadData: Boolean; virtual;
function Macro(cKey: string; oParas: TStringList): WideString; virtual;
function GetSqlParaKey(iIndex: Integer): string;
function GetSqlParaValue(iIndex: Integer): string; overload;
function GetSqlParaValue(cKey: string): string; overload;
property SqlParaCount: Integer read _GetSqlParaCount;
property Query: TDpAdoQuery read _GetQuery;
property Count: Integer read _GetCount write _SetCount;
property Eof: Boolean read _GetEof;
property NewPage: Boolean read _lNewPage write _lNewPage;
property Page: Integer read _iPage write _iPage; //パPressCore 糶
property SubPage: Integer read _iSubPage write _iSubPage; //パPressCore 糶
property ErrCode: LongInt read _GetErrCode;
property ErrMess: string read _GetErrMess;
procedure MoveRecords(iStep: Integer); virtual;
function GetSql: string;
end;

TDpPressData = class(TDpPressDataBase)
public
function Macro(cKey: string; oParas: TStringList): WideString; override;
end;

TDpPressCore = class(TDpInterfaceObj, iPresswork)
private
_cID: string;
_cType: string; //S/E/C
_cErrMess: string;
_iCopyNum: Integer;
_iPageFrom: Integer;
_iPageTo: Integer;
_iGenerated: Integer;
_iErrCode: LongInt;
_lAutoPrint: Boolean;
_lFastPrint: Boolean;
_oMacro: TDpMacro;
_iiPressData: iPressData;
_oPressDataObj: TDpInterfaceObj;
_oPrinter: TDpSfcPrinter;
_pOnNewPage: TDpEventNewPage;
function _GetID: string;
function _GetType: string;
function _GetErrMess: string;
function _GetCopyNum: Integer;
function _GetPrinter: TDpSfcPrinter;
function _GetPressData: iPressData;
function _GetPressDataObj: TDpInterfaceObj;
function _GetPageFrom: Integer;
function _GetPageTo: Integer;
function _GetErrCode: LongInt;
procedure _SetID(cID: string);
procedure _SetPrinter(oPrinter: TDpSfcPrinter);
procedure _SetPressDataObj(oData: TDpInterfaceObj);
procedure _SetCopyNum(iCopyNum: Integer);
procedure _SetOnNewPage(pOnNewPage: TDpEventNewPage);
procedure _SetAutoPrint(lAutoPrint: Boolean);
procedure _SetType(cType: string);
procedure _SetPageFrom(iPageFrom: Integer);
procedure _SetPageTo(iPageTo: Integer);
procedure _SetFastPrint(lFastPrint: Boolean);
procedure _ExtractMargin(cType: string; var iX, iY: Integer);
public
constructor Create; override;
Destructor Destroy; override;
property ID: string read _GetID write _SetID;
property CopyNum: Integer read _GetCopyNum write _SetCopyNum;
property AutoPrint: Boolean read _lAutoPrint write _SetAutoPrint;
property PressData: iPressData read _GetPressData;
property PressDataObj: TDpInterfaceObj read _GetPressDataObj write _SetPressDataObj;
property Printer: TDpSfcPrinter read _GetPrinter write _SetPrinter;
property OnNewPage: TDpEventNewPage write _SetOnNewPage;
property MyType: string read _GetType write _SetType;
property PageFrom: Integer read _GetPageFrom write _SetPageFrom;
property PageTo: Integer read _GetPageTo write _SetPageTo;
property FastPrint: Boolean write _SetFastPrint;
property ErrCode: LongInt read _GetErrCode;
property ErrMess: string read _GetErrMess;

function InitMe(cFile: string; adoCnt: TDpAdoConnect): Boolean; virtual; abstract;
function Generate: Boolean; virtual;
function GenerateCore: Boolean; virtual;
function Print: Boolean; virtual;
procedure SetMarginLeft(iMarginLeft: Integer); virtual;
procedure SetMarginTop(iMarginTop: Integer); virtual;
end;

TDpPressScript = class(TDpPressCore)
private
_cScriptOrg: string; // Original Script Text
_cScriptCvt: string;
_cBatchFile: string;
_lBatchPrn: Boolean;
_lGenerating: Boolean;
procedure _SetBatchPrn(lBatchPrn: Boolean);
public
property BatchPrn: Boolean read _lBatchPrn write _SetBatchPrn;
function InitMe(cScript: string; adoCnt: TDpAdoConnect): Boolean; override;
function Generate: Boolean; override;
function GenerateCore: Boolean; override;
function Print: Boolean; override;
end;

TDpPressCodeSoft = class(TDpPressCore)
private
_iCount: Integer;
_cTemplateFile: string; // Keep Template File Full Path
_lFastPrint: Boolean;
_vCodeSoftApp: Variant;
_vCodeSoftDoc: Variant;
_aVarList: array of array of string;
function _Feed: Boolean;
public
destructor Destroy; override;
function InitMe(cFile: string; adoCnt: TDpAdoConnect): Boolean; override;
function GenerateCore: Boolean; override;
function Generate: Boolean; override;
function Print: Boolean; override;
property VarCount: Integer read _iCount;
property FastPrint: Boolean read _lFastPrint write _lFastPrint; //ネΘゅンΩ
procedure SetMarginLeft(iMarginLeft: Integer); override;
procedure SetMarginTop(iMarginTop: Integer); override;
end;

TDpBarTender = class(TDpPressCore)
private
_iCount: Integer;
_cTemplateFile: string;
_vBarTenderApp: Variant;
_vBarTenderFmt: Variant;
_aVarList: array of array of string;
{ Private declarations }
public
{ Public declarations }
destructor Destroy; override;
function InitMe(cFile: string; adoCnt: TDpAdoConnect): Boolean; override;
function Generate: Boolean; override;
function GenerateCore: Boolean; override;
function Print: Boolean; override;
property VarCount: Integer read _iCount;
procedure SetMarginLeft(iMarginLeft: Integer); override;
procedure SetMarginTop(iMarginTop: Integer); override;
end;

TDpExcelRange = record
Row1: Integer;
Row2: Integer;
Col1: Integer;
Col2: Integer;
end;

TDpMacroCell = class(TObject)
private
_FText: string;
_FPosStr: string;
public
property Text: string read _FText write _FText;
property PosStr: string read _FPosStr write _FPosStr;
function GetPosStr(iRowOffset, iColOffset: Integer): string;
end;

TDpPressExcelArea = class(TObject)
private
_FSql: string;
_FMacroCells: TDpList;
_FPressData: iPressData;
_FPressDataObj: TDpInterfaceObj;
public
constructor Create;
destructor Destroy; override;
property SQL: string read _FSql write _FSql;
property MacroCells: TDpList read _FMacroCells;
property PressData: iPressData read _FPressData;
property PressDataObj: TDpInterfaceObj read _FPressDataObj;
procedure LinkData(oData: TDpInterfaceObj);
end;

51,396

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧