Code above is XML code, through txmldocument read the rows and columns, according to line according to the cell lines and text output to the printer, the output is correct in the pictures, the effect the following
But the output to the printer, the other works, form the first line of the first cell to the left in the 1 mm error, I depressed!!!!! (don't know if the printer problem)
The following is the code:
Dbug:=1;
Act:='print';
//http://localhost:8080/print? Pid=20110705000002 & amp; Djid=20121123000004 & amp; Djtype=xsdingdan& The client=delphi& Act=loadview
The pid: Get_PID=();
Djid=Get_DJID ();
Djtype: Get_DJTYPE=();
Client:='Delphi';
Param:=TStringList. Create;
RStream:=TStringStream. Create (");
Param. Add (' act=loadview ');
Param. Add (' pid='+ pid);
Param. The Add (+ djid djid=);
Param. The Add (+ djtype djtype=);
Param. The Add (+ client client=);
Url:=rootpath + 'print';
Self. Idhttp. Post (' http://localhost:8080/print 'Param, RStream);
Xmlstring:='& lt; ? The XML version="1.0" encoding="gb2312"?> ';
Xmlstring:=xmlstring + RStream. DataString;
PXML:=xmlstring;
Mx:=TXMLDocument. Create (self);
Mx. XML. The Add (xmlstring);
Mx. Active:=true;
Printname:=mx. DocumentElement..childnodes [' printname]. The Text;
Printwidth:=mx. DocumentElement..childnodes [' printwidth]. The Text;
Printheight:=mx. DocumentElement..childnodes [' printheight]. The Text;
Printer. Title:='sales order to print;
SetPaperWidth (round (strtofloat (printwidth)));//mm
SetPaperHeight (round (strtofloat (printheight)));
MyCanvas:=Printer. Canvas;
Printer. BeginDoc;
MyCanvas. Brush. Color:=clWhite;
MyCanvas. FillRect (MyCanvas. ClipRect);//remove residual image
MyCanvas. Brush. Color:=clBlue;
MyCanvas. Brush. Style:=bsclear;
MyCanvas. Pen. Color:=clBlack;
MyCanvas. The Font. Color:=clBlack;
Rowcount:=mx. DocumentElement..childnodes [' mxbody].childnodes. Count;
Pagecount:=1;
Pagesize:=0;
Tableleft:=0;
Tabletop:=0;
Tabrowcount:=0;
Tabmaxheight:=0;
If mx. DocumentElement..childnodes [' printtable].childnodes. Count<> 0 then
The begin
Pagesize:=StrToInt (mx. DocumentElement..childnodes [' printtable].childnodes [' mxloop]. Text);
Then if (rowcount mod pagesize)=0
Pagecount:=Trunc (rowcount/pagesize)
The else
Pagecount:=Trunc (rowcount/pagesize) + 1;
Tableleft:=StrToFloat (mx. DocumentElement..childnodes [' printtable].childnodes [r]. "MXX" Text);
Tabletop:=StrToFloat (mx. DocumentElement..childnodes [' printtable].childnodes [' mxy]. Text);
Tabrowcount:=mx. DocumentElement..childnodes [' printtable].childnodes [' table '].childnodes. Count;
The end;
Tableleftold:=tableleft;
I:=0;
Currentpage:=0;
At:=0;
Pagecount:=1;
While currentpage
While i
Trnode:=mx. DocumentElement..childnodes [' printtable].childnodes [' table '].childnodes [I];
Rowheight=Real (trnode. Attributes [' height ']);
Rowtype:=trnode. Attributes [' rowtype];
K:=0;
Cellcount:=trnode.childnodes. Count;
If trnode. HasAttribute (' loop ') then
The begin
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- is a subsidiary part -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Mxnum:=Integer (trnode. Attributes [' loop ']);
Mxrowheight:=Real (trnode. Attributes [' height ']);
While (k
J:=0;
While j
Tdnode:=trnode.childnodes [j];
Cellwidth:=Real (tdnode. Attributes [' width ']);
TXT:=tdnode. Text;
If tdnode. HasAttribute (' binding ') then
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull