Tag: devexpress

Devexpress DXGrid – 打印/导出自定义单元格样式

我是DE控制中的一个新手,我仍然在评估产品,我有一个小问题。 我有一个网格有两列,其中backcolors是由logging状态(例如,如果状态是1,单元格的背景颜色必须是红色)定义。 对于collumn的CellStyle,我使用自定义的customCellStyle,一切正常。 <Style x:Key="customCellStyle" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=CellStyle}}" TargetType="{x:Type dxg:CellContentPresenter}"> <Setter Property="Background"> <Setter.Value> <MultiBinding> <MultiBinding.Converter> <local:StatusToBackroundColorConverter /> </MultiBinding.Converter> <Binding Path="Column" RelativeSource="{RelativeSource Self}" /> <Binding Path="Data.RowHandle.Value" /> <Binding Path="Data.DocumentStatusId" /> </MultiBinding> </Setter.Value> </Setter> 但是,当我试图完成导出或打印网格视图,它根本不工作。 虽然,它的作品,如果单元格的背景颜色是硬编码,我不能让它与绑定工作。 代码如下所示: 为了简单起见,我没有使用转换器。 StatusBackColor有一种types的画笔。 <Style x:Key="customPrintCellStyle" BasedOn="{StaticResource {dxgt:TableViewThemeKey ResourceKey=DefaultPrintCellStyle}}" TargetType="dxe:TextEdit"> <Style.Setters> <Setter Property="dxp:ExportSettings.TargetType" Value="Panel"/> <Setter Property="DisplayTemplate"> <Setter.Value> <ControlTemplate TargetType="dxe:TextEdit"> <dxe:TextEdit Text="{Binding Value}" […]

如何解决无法投射“System.Data.DataView”types的对象来键入“System.Data.DataTable”错误

我在表单上有Devxpress GridControl, 我想发送这个网格上的数据,以优秀。 我不想用ExportToExcel方法做到这一点 我GOOGLE了,发现这个代码 但是这个代码是用于.Net的DataGrid控件,当它试图将DevExpress.XtraGrid.Views.Grid.GridView转换为System.Data.DataView时会产生错误 这里是代码 public string LastCoulmLetter(int coulmnCount) { string finalColLetter = string.Empty; string colCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int colCharsetLen = colCharset.Length; if (coulmnCount > colCharsetLen) { finalColLetter = colCharset.Substring( (coulmnCount – 1) / colCharsetLen – 1, 1); } finalColLetter += colCharset.Substring( (coulmnCount – 1) % colCharsetLen, 1); return finalColLetter; } public void […]

ASP.NET – 能够导出CSV / Excel到多个工作表?

我想知道是否有人有一个解决scheme,能够导出到多个工作表的Excel中的数据…截至目前,我只知道如何导出多个对象到一个单一的表! 我正在使用Devexpress出口商? 似乎他们不支持这一点,我可以用一个通用的解决scheme呢? 任何指导将不胜感激!

使用带格式文本的ASPxGridViewExporter将ASPxGridView导出到xlsx

我有一个ASPxGridView有许多列(typesGridViewDataComboBoxColumn或GridViewDataHyperLinkColumn )。 在网格的CustomColumnDisplayText事件后面的代码中,我按以下方式格式化单元格的文本: protected void MyGrid_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column is DevExpress.Web.ASPxGridView.GridViewDataColumn) { switch (e.Column.FieldName) { case "Energy": if (e.Value is float) { // the FormatEnergy method here returns for example "323.32 kWh" e.DisplayText = DataDisplayTools.Instance.FormatEnergy((float)e.Value); } break; // other cases } } } 为了以.xlsx格式导出网格视图,我使用了一个ASPxGridViewExporter : protected void lnkXlsxExport_Click(object sender, EventArgs e) { […]

将新列添加到GridView DevExpress

我从Excel导入工作表。 我需要在网格的最后添加一个新的单元格,其中包含有关空单元格的消息,并将其保存在一个名为msg的数组中; private void simpleButton1_Click(object sender, System.EventArgs e) { try { OleDbConnection con = new OleDbConnection(); con.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\\Users\\pc\\Documents\\Emp.xlsx;Extended Properties=\"Excel 12.0;HDR=Yes\""; con.Open(); DataTable dtSchema; dtSchema = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); OleDbCommand Command = new OleDbCommand ("select * FROM [" + dtSchema.Rows[0]["TABLE_NAME"].ToString() + "]", con); OleDbDataAdapter da = new OleDbDataAdapter(Command); […]

DevExpress将GridView导出到Excel

我真的需要这个帮助..我找不到任何互联网上的例子我正在使用DevExpress GridView我需要把它发送到Excel,我得到问题,以循环到每个单元格和列,因为DevExpress包含不同的方法,然后的DataGridView 这是我想写的代码..我真的很感谢你的帮助 public class Form1 : System.Windows.Forms.Form { Microsoft.Office.Interop.Excel.ApplicationClass ExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass(); string FirstName = "First Name"; string FatherName = "Father Name"; string LastName = "Last Name"; } public Form1() { ExcelApp.Application.Workbooks.Add(Type.Missing); ExcelApp.Columns.ColumnWidth = 20; // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after […]