zoukankan      html  css  js  c++  java
  • C# Dev XtraReport 简单测试

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using DevExpress.XtraReports.UI; 
    using System.Data;
    
             public void LoadData()
             {
                 DataTable mfdt = DS.Tables["主表"];
                 for (int i = 0;i< mfdt.Columns.Count; i++)
                 {
                     string Columnname = mfdt.Columns[i].ColumnName;
                     string ColVale = mfdt.Rows[0][Columnname].ToString();
                     SetLable(Columnname, ColVale, xtraReport, "");
                     SetLable(Columnname, ColVale, xtraReport, "1");
                     SetLable(Columnname, ColVale, xtraReport, "2");
                     SetLable(Columnname, ColVale, xtraReport, "3");
    
                     SetBarCode(Columnname, ColVale, xtraReport, "");
                     SetBarCode(Columnname, ColVale, xtraReport, "1");
                     SetBarCode(Columnname, ColVale, xtraReport, "2");
                     SetBarCode(Columnname, ColVale, xtraReport, "3");
                 }
    
                 DetailBand trb = xtraReport.FindControl("detailBand1", true) as DetailBand;
                 XRTable xbtb = trb.FindControl("table1", true) as XRTable;
                 XRTableRow tableRow1 = xbtb.FindControl("tableRow1", true) as XRTableRow;
                 XRTableCell tableCell1 = xbtb.FindControl("tableCell1", true) as XRTableCell;
                 XRTableCell tableCell2 = xbtb.FindControl("tableCell2", true) as XRTableCell;
                 XRTableCell tableCell3 = xbtb.FindControl("tableCell3", true) as XRTableCell;

    //明细表
    xtra.DataSource = ds.Tables[1];
    tableCell1.DataBindings.Add("Text", ds.Tables[1], "TF_POS.OS_NO");
    tableCell2.DataBindings.Add("Text", ds.Tables[1], "TF_POS.ITEM");
    tableCell3.DataBindings.Add("Text", ds.Tables[1], "TF_POS.PRD_NO");

    
             }
    
    
             /// <suary>
             /// 设置对象Text
             /// </summary>
             /// <param name="col">字段</param>
             /// <param name="colvale">字段值</param>
             /// <param name="xtra">报表对象</param>
             public void SetLable(string col, string colvale, XtraReport xtra, string inx)
             {
                 try
                 {
                     XRLabel TxtColumnName1 = xtra.FindControl("txt" + col + inx, true) as XRLabel;
                     TxtColumnName1.Text = colvale;
                 }
                 catch (Exception)
                 {
    
                 }
             }
             /// <summary>
             /// 设置对象Text
             /// </summary>
             /// <param name="col">字段</param>
             /// <param name="colvale">字段值</param>
             /// <param name="xtra">报表对象</param>
             public void SetBarCode(string col, string colvale, XtraReport xtra, string inx)
             {
                 try
                 {
                     XRBarCode xrbar = xtra.FindControl("bar" + col + inx, true) as XRBarCode;
                     xrbar.AutoModule = true;
                     //xrbar.Dpi = 254F; //xrbar.Location = rpb.pint.IsEmpty ? new Point(0, 0) : rpb.pint;
                     //xrbar.Module = 5.08F;
                     //xrbar.Size = rpb.size.IsEmpty ? new Size(this.PageWidth - this.Margins.Left - this.Margins.Right, 150) : rpb.size;
                     xrbar.Text = colvale;
                     xrbar.ShowText = true;
                 }
                 catch (Exception)
                 {
    
                 }
             }
  • 相关阅读:
    webstorm激活方法webstorm注册码 jetbrains激活
    Android获取通讯录并上传(包含通讯录加密)
    2018,愿跟大家一起成长!
    Android Activity的4种启动模式
    微信SDK登录无法调起,微信SDK无法接收回调的几种解决办法
    Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误
    eclipse 和 android studio 编译时报 Unsupported major.minor version 52.0错解决办法
    Git – fatal: Unable to create ‘/.git/index.lock’: File exists错误解决办法
    android中xmlns:tools属性详解
    .NET Core 3.1 跨域请求 (CORS)
  • 原文地址:https://www.cnblogs.com/lanyubaicl/p/8808061.html
Copyright © 2011-2022 走看看