国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

用Ehlib二次開發報表打印程序,實現財務憑證的打印(三)

2019-11-18 18:36:01
字體:
來源:轉載
供稿:網友
 

4、打印表頭,我將表頭的各個部分劃成了幾部分,如我的憑證打印的地方,我就劃成了五部分,每部分按占百分比多少計算。如編制單位就占頁面寬度的40%等

PRocedure TF_printpreview.printpageheader(pageheader: Tstrings);
var
  Headrect:Trect;
  count:integer;
begin
  pp_pz.Printer.Canvas.Font.Name:='宋體';
  pp_pz.Printer.Canvas.Font.Color:=clblack;
  pp_pz.Printer.Canvas.Font.Size:=9;
  pp_pz.Printer.Canvas.Font.Style:=[];
  gettextinfo;
  Amountprint:=Amountprint+round(0.8*textheight);//當前邏輯尺的位置
  for  count:=0 to pageheader.Count-1 do
  begin
    case count of
      0:
       HeadRect:=Rect(round(pp_pz.Printer.PageSet.LeftMargin),Amountprint,round(pp_pz.Printer.PageSet.LeftMargin+round(0.4*(pp_pz.Printer.PageWidth))),Amountprint+textheight);//編制單位比例
      1:
       HeadRect:=Rect(headrect.Right,Amountprint,headrect.Right+round(0.16*(pp_pz.Printer.PageWidth)),Amountprint+textheight);//憑證日期比例
      2:
       HeadRect:=Rect(headrect.Right,Amountprint,headrect.Right+round(0.14*(pp_pz.Printer.PageWidth)),Amountprint+textheight);//帳套號比例
      3:
       HeadRect:=Rect(headrect.Right,Amountprint,headrect.Right+round(0.2*(pp_pz.Printer.PageWidth)),Amountprint+textheight);//憑證號比例
      4:
       HeadRect:=Rect(headrect.Right,Amountprint,headrect.Right+round(0.1*(pp_pz.Printer.PageWidth)),Amountprint+textheight);//分頁數號比例
    end;
    pp_pz.Printer.Canvas.TextOut(Headrect.left,headrect.top,pageheader[count]);
  end;
end;

5、打印表格頭

procedure TF_mxzprint.printdetailheader(detailheader: Tstrings);
var
  drect,srect,jrect:Trect;
begin
    pp_pz.Printer.Canvas.Font.Name:='宋體';
    pp_pz.Printer.Canvas.Font.Color:=clblack;
    pp_pz.Printer.Canvas.Font.Size:=9;
    pp_pz.Printer.Canvas.Font.Style:=[];
    gettextinfo;
    Amountprint:=Amountprint+textheight;
    pp_pz.Printer.Canvas.Font.Size:=11;
    drect:=rect(PageRect.Left,Amountprint,PageRect.Left+round(0.3*(PageRect.Right-PageRect.Left)),Amountprint+2*textheight);
    drawtext(pp_pz.Printer.Canvas.handle,pchar('摘   要'),length('摘  要'),drect,DT_center or  DT_WordBREAK or DT_VCENTER or DT_SINGLELINE);
    addpolyline([drect.left,drect.top,drect.right,drect.top,drect.right,drect.bottom,drect.left,drect.bottom,drect.left,drect.top]);

    drect:=rect(drect.right,drect.Top,drect.right+round(0.4*(PageRect.Right-PageRect.Left)),srect.Bottom);
    drawtext(pp_pz.Printer.Canvas.handle,pchar('科目名稱'),length('科目名稱'),drect,DT_center or  DT_WORDBREAK or DT_VCENTER or DT_SINGLELINE);
    addpolyline([drect.left,drect.top,drect.right,drect.top,drect.right,drect.bottom,drect.left,drect.bottom,drect.left,drect.top]);
    drect:=rect(drect.right,drect.Top,drect.right+round(0.15*(PageRect.Right-PageRect.Left)),srect.Bottom);
    drawtext(pp_pz.Printer.Canvas.handle,pchar('借方金額'),length('借方金額'),drect,DT_center or  DT_WORDBREAK or DT_VCENTER or DT_SINGLELINE);

    addpolyline([drect.left,drect.top,drect.right,drect.top,drect.right,drect.bottom,drect.left,drect.bottom]);
    drect:=rect(drect.right,drect.Top,drect.right+round(0.15*(PageRect.Right-PageRect.Left)),srect.Bottom);
    addpolyline([drect.left,drect.top,drect.right,drect.top,drect.right,drect.bottom,drect.left,drect.bottom,drect.left,drect.top]);
    drawtext(pp_pz.Printer.Canvas.handle,pchar('貸方金額'),length('貸方金額'),drect,DT_center or  DT_WORDBREAK or DT_VCENTER or DT_SINGLELINE);

    addpolyline([drect.left,drect.top,drect.right,drect.top,drect.right,drect.bottom,drect.left,drect.bottom]);
    Amountprint:=amountprint+drect.Bottom-drect.Top;//+textheight;
end;

5、打印表格內容

(與上面相似,代碼太多,略。。。)

6、打印匯總欄內容(代碼較多,而且也相似,略)

7、執行打印功能

  pp_pz.Printer.BeginDoc;
  依次打印標題、打印、表頭等

  PolyPolyline(pp_pz.Printer.Canvas.Handle,PolyPolyPoints.List^,PolyLengths.List^,PolyLengths.Count);  pp_pz.Printer.EndDoc;

 

關鍵:就兩個函數PolyPolyline和DrawText而已!

請注意,我這是連載,我發現我最后一貼看的人比較多,可光看這篇基本上看不出什么來的。管理員沒有發表我的第一篇,我現在把第一篇放到了連(二)里面去了,所以大家不要找連載(一)了!由于時間比較忙,所以有一部分朋友要求要源碼還沒來的及整理,但我一整理出來我就會發過去的,謝謝大家!

好了,如果大家需要源碼可以向我索取,yczyk@163.com


上一篇:有關ADO專題

下一篇:圖像分割的一些簡單實現

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
學習交流
熱門圖片

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 娱乐| 观塘区| 澄江县| 呼和浩特市| 石家庄市| 甘谷县| 营山县| 富蕴县| 武鸣县| 云浮市| 略阳县| 武汉市| 黎城县| 慈溪市| 许昌县| 南郑县| 湘潭市| 浮山县| 五常市| 泗水县| 县级市| 潢川县| 垦利县| 莱芜市| 杭锦后旗| 永定县| 梅河口市| 玉屏| 天门市| 全州县| 嘉荫县| 宜昌市| 敦化市| 潢川县| 宁南县| 同仁县| 富顺县| 阿拉善右旗| 辉县市| 连州市| 昆山市|