我已将我的应用程序迁移到Dev Express 15.2。迁移后的数据没有以GridView样式导出。像备用行颜色,字体..等等。我们有任何选项可以像在网格中一样导出数据。
设计
this.gridView1.Appearance.EvenRow.BackColor = System.Drawing.Color.Khaki;
this.gridView1.Appearance.EvenRow.Options.UseBackColor = true;
this.gridView1.Appearance.GroupPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74)))));
this.gridView1.Appearance.GroupPanel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold);
this.gridView1.Appearance.GroupPanel.Options.UseBackColor = true;
this.gridView1.Appearance.GroupPanel.Options.UseFont = true;
this.gridView1.Appearance.HeaderPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.gridView1.Appearance.HeaderPanel.Options.UseBackColor = true;
this.gridView1.AppearancePrint.EvenRow.BackColor = System.Drawing.Color.Khaki;
this.gridView1.AppearancePrint.EvenRow.Options.UseBackColor = true;
this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
this.gridColumn1,
this.gridColumn2,
this.gridColumn3,
this.gridColumn4,
this.gridColumn5});
this.gridView1.GridControl = this.gridControl1;
this.gridView1.GroupSummary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
new DevExpress.XtraGrid.GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, "OrderID", null, "")});
this.gridView1.Name = "gridView1";
this.gridView1.OptionsView.EnableAppearanceEvenRow = true;
cs文件中的代码
if(ext == "xlsx")
{
XlsxExportOptionsEx options = new XlsxExportOptionsEx();
options.ShowGridLines = false;
options.AllowSortingAndFiltering = DevExpress.Utils.DefaultBoolean.False;
options.ExportType = DevExpress.Export.ExportType.WYSIWYG;
exportView.ExportToXlsx(filename, options);
}
答案 0 :(得分:0)
通过设置以下属性,问题得以解决。
((DevExpress.XtraGrid.Views.Grid.GridView)gridControl1.MainView).OptionsPrint.EnableAppearanceEvenRow = true;
((DevExpress.XtraGrid.Views.Grid.GridView)gridControl1.MainView).OptionsPrint.UsePrintStyles = false;