Dev Express打印按钮

本文关键字:按钮 打印 Express Dev | 更新日期: 2023-09-27 18:14:41

HI有一个dev express grid 13.2我如何允许用户打印网格?想要打印----------或通过导出到excel。

    using DevExpress.Web.ASPxEditors;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web.ASPxTreeView;
using FDB.Base;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//* --------------------------------------------------------------------------
namespace FDB.Views
{
    public partial class Interchange : BasePage
    {
        #region Properties
        public string ID_KEY
        {
            get
            {
                if (hfCommon.Contains("ID_KEY"))
                    return hfCommon.Get("ID_KEY").ToString();
                else
                    return "";
            }
            set
            {
                if (hfCommon.Contains("ID_KEY"))
                    hfCommon.Set("ID_KEY", value);
                else
                    hfCommon.Add("ID_KEY", value);
            }
        }
        public decimal SEQNO
        {
            get
            {
                if (hfCommon.Contains("SEQNO"))
                    return hfCommon.Get("SEQNO").ToDecimal();
                else
                    return 0;
            }
            set
            {
                if (hfCommon.Contains("SEQNO"))
                    hfCommon.Set("SEQNO", value);
                else
                    hfCommon.Add("SEQNO", value);
            }
        }
//* --------------------------------------------------------------------------
        public int STAT
        {
            get
            {
                if (hfCommon.Contains("STAT"))
                    return hfCommon.Get("STAT").ToInt();
                else
                    return 0;
            }
            set
            {
                if (hfCommon.Contains("STAT"))
                    hfCommon.Set("STAT", value);
                else
                    hfCommon.Add("STAT", value);
            }
        }
//* --------------------------------------------------------------------------
        public string NDC
        {
            get
            {
                if (hfCommon.Contains("NDC"))
                    return hfCommon.Get("NDC").ToString();
                else
                    return "";
            }
            set
            {
                if (hfCommon.Contains("NDC"))
                    hfCommon.Set("NDC", value);
                else
                    hfCommon.Add("NDC", value);
            }
        }
        public string Reason
        {
            get
            {
                if (hfCommon.Contains("Reason"))
                    return hfCommon.Get("Reason").ToString();
                else
                    return "";
            }
            set
            {
                if (hfCommon.Contains("Reason"))
                    hfCommon.Set("Reason", value);
                else
                    hfCommon.Add("Reason", value);
            }
        }
        public string ReasonText
        {
            get
            {
                if (hfCommon.Contains("ReasonText"))
                    return hfCommon.Get("ReasonText").ToString();
                else
                    return "";
            }
            set
            {
                if (hfCommon.Contains("ReasonText"))
                    hfCommon.Set("ReasonText", value);
                else
                    hfCommon.Add("ReasonText", value);
            }
        }
        public bool OnClickonShowData
        {
            get
            {
                if (hfCommon.Contains("OnClickonShowData"))
                    return hfCommon.Get("OnClickonShowData").ToBoolean();
                else
                    return false;
            }
            set
            {
                if (hfCommon.Contains("OnClickonShowData"))
                    hfCommon.Set("OnClickonShowData", value);
                else
                    hfCommon.Add("OnClickonShowData", value);
            }
        }

        public bool ShowHideFilter
        {
            get
            {
                if (hfCommon.Contains("ShowHideFilter"))
                    return hfCommon.Get("ShowHideFilter").ToBoolean();
                else
                    return false;
            }
            set
            {
                if (hfCommon.Contains("ShowHideFilter"))
                    hfCommon.Set("ShowHideFilter", value);
                else
                    hfCommon.Add("ShowHideFilter", value);
            }
        }
        #endregion
        #region Events
        protected void Page_Load(object sender, EventArgs e)
        {
            FDB.Enums.UserType userType = (FDB.Enums.UserType)Session["UserType"];
            this.gvPBMCharges.HtmlRowCreated += gvPBMCharges_HtmlRowCreated;
            this.gvPBMCharges.CustomCallback += gvPBMCharges_CustomCallback;
            this.gvPBMCharges.HtmlRowPrepared += gvPBMCharges_HtmlRowPrepared;
            this.gvPBMCharges.EnableRowsCache = false;
            ChckLogin();
            LoadTitle();
            PopulateFacilityList();
            if (!IsPostBack && !IsCallback)
            {
                this.OnClickonShowData = false;
                //SelectAllNodes();
                if (userType != Enums.UserType.Admin_User)
                {
                    chkSelectAll.Checked = true;
                    cblFacility.SelectAll();

//* --------------------------------------------------------------------------

Dev Express打印按钮

你应该使用DevExpress提供的aspxgridviewexporters特殊组件来支持将ASPxGridView导出为不同的格式。它的用法非常清楚,在aspxgridviewexporters的在线文档中有解释。要将ASPxGridView导出到Excel,您需要使用以下任何方法:

WriteXls, WriteXlsToResponse, WriteXlsx, WriteXlsxToResponse。所有这些都在这里描述:

Documenation