Devexpress gridview export customised header

using DevExpress.XtraPrinting;
using DevExpress.Printing.ExportHelpers;
using DevExpress.Export;

private void simpleButton1_Click(object sender, EventArgs e) {
// Ensure that the data-aware export mode is enabled.
DevExpress.Export.ExportSettings.DefaultExportType = ExportType.DataAware;
// Create a new object defining how a document is exported to the XLSX format.
XlsxExportOptionsEx options = new XlsxExportOptionsEx();
// Subscribe to the CustomizeSheetHeader event.
options.CustomizeSheetHeader += options_CustomizeSheetHeader;
// Export the grid data to the XLSX format.
string file = "grid-export.xlsx";
gridControl.ExportToXlsx(file, options);
// Open the created document.
System.Diagnostics.Process.Start(file);
}

void options_CustomizeSheetHeader(DevExpress.Export.ContextEventArgs e) {
// Create a new row.
CellObject row = new CellObject();
// Specify row values.
row.Value = "The document is exported from the IssueList database.";
// Specify row formatting.
XlFormattingObject rowFormatting = new XlFormattingObject();
rowFormatting.Font = new XlCellFont { Bold = true, Size = 14 };
rowFormatting.Alignment = new DevExpress.Export.Xl.XlCellAlignment { HorizontalAlignment = DevExpress.Export.Xl.XlHorizontalAlignment.Center, VerticalAlignment = DevExpress.Export.Xl.XlVerticalAlignment.Top };
row.Formatting = rowFormatting;
// Add the created row to the output document.
e.ExportContext.AddRow(new [] {row});
// Add an empty row to the output document.
e.ExportContext.AddRow();
// Merge cells of two new rows.
e.ExportContext.MergeCells(new DevExpress.Export.Xl.XlCellRange(new DevExpress.Export.Xl.XlCellPosition(0, 0), new DevExpress.Export.Xl.XlCellPosition(5, 1)));
}

Devexpress gridview export to excel with savefiledialog

            string filename;
            saveFileDialog1.Filter = "xlsx files (*.xlsx)|*.xlsx";
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;
            saveFileDialog1.ShowDialog();
            filename = saveFileDialog1.FileName;
            if (filename == "") filename = "";
            else
            {
                gridView1.ExportToXlsx(filename);
                System.Diagnostics.Process.Start(filename);
            }

VISUAL STUDIO 2013 VISUAL BASIC GRIDE EXCELDEN YAPIŞTIR

VISUAL STUDIO 2013 VISUAL BASIC GRIDE EXCELDEN YAPIŞTIR

ONCE BU FONKSIYONU EKLE;
———————-
Sub pastefromclipboardtodatagridview(ByVal dgv As DataGridView)
        Dim rowSplitter As Char() = {vbCr, vbLf}
        Dim columnSplitter As Char() = {vbTab}

        ‘get the text from clipboard

        Dim dataInClipboard As IDataObject = Clipboard.GetDataObject()
        Dim stringInClipboard As String = CStr(dataInClipboard.GetData(DataFormats.Text))

        ‘split it into lines
        Dim rowsInClipboard As String() = stringInClipboard.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries)

        ‘get the row and column of selected cell in grid
        Dim r As Integer = dgv.SelectedCells(0).RowIndex
        Dim c As Integer = dgv.SelectedCells(0).ColumnIndex

        ‘add rows into grid to fit clipboard lines
        If (dgv.Rows.Count < (r + rowsInClipboard.Length)) Then
            dgv.Rows.Add(r + rowsInClipboard.Length – dgv.Rows.Count)
        End If

        ‘ loop through the lines, split them into cells and place the values in the corresponding cell.
        Dim iRow As Integer = 0
        While iRow < rowsInClipboard.Length
            ‘split row into cell values
            Dim valuesInRow As String() = rowsInClipboard(iRow).Split(columnSplitter)
            ‘cycle through cell values
            Dim iCol As Integer = 0
            While iCol < valuesInRow.Length
                ‘assign cell value, only if it within columns of the grid
                If (dgv.ColumnCount – 1 >= c + iCol) Then
                    dgv.Rows(r + iRow).Cells(c + iCol).Value = valuesInRow(iCol)
                End If
                iCol += 1
            End While
            iRow += 1
        End While

    End Sub

—————

1 ADET DATAGRIDVIEW YARAT
1 ADET BUTTON YARAT
CİFT TIKLA BUTTONA
KOD:
        DataGridView1.AllowUserToAddRows = False
        DataGridView1.Rows.Add()
        pastefromclipboardtodatagridview(DataGridView1)
        DataGridView1.AllowUserToAddRows = False
        DataGridView1.Rows.Add()
        pastefromclipboardtodatagridview(DataGridView1)

vs 2013 c# Devexpress gridview sağ tıklayarak excel dosyası olarak kaydet

Forma 1 adet contextMenuStrip1 ve 1 adet saveFileDialog1 at gridControl1de ki dataları excele kaydetmek için;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.OleDb;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;

contextMenuStrip1  tıkla Excele kaydet item yarat ve çift tıkla ve yaz;

            //excele kaydet
            string filename;
            saveFileDialog1.Filter = “xlsx files (*.xlsx)|*.xlsx”;
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;
            saveFileDialog1.ShowDialog();
            filename = saveFileDialog1.FileName;
            if (filename == “”) filename = “”; else gridView1.ExportToXlsx(filename);

Daha sonra gridcontrola tıkla ve contextmenustripini contextMenuStrip1 olarak seç

excel filter by combobox

Önce tabloyu oluştur. 
—————-
sonra comboboxda örneğin isim sutununa göre filtreleme isdersen isimleri teklememiz lazım. isim sutnununu (b4:b10) başka bir sheete kopyala(sheet2 : a hücresinin altına) ve sheet2dekini data remove dublicate yap ve sheet2 b1 hucresininin adını filtre kod yap ve altına sayıları otomatik sırala.
——————
daha sonra sheet2deki teklenmiş filtreleme verilerini seç ve formulas -> define nameden ismini Comboboxfiltre yap
————————–
daha sonra developer insert combobox yap ve propertiese tıkla
inpute rangei comboboxfiltre yap 
cell linkide comboboxun yanlarına biryere tıkla ÖRNEK J1
not: cell link combobox değiştikçe o hücre değişen değer olur
———————–
daha sonra sheet 1deki a3 hücresinin adına filtrekod koy ve altına =VLOOKUP(B4;Sheet2!$A$2:$B$6;2;FALSE) kodlarını yapıştır
———————–
COMBOBOXA SAĞ TIKLA DEVELOPER MODDAN VIEW CODA TIKLA
VE AŞAĞIDAKİLERİ YAPIŞTIR
   Selection.AutoFilter
    ActiveSheet.Range(“$A$2:$B$30”).AutoFilter Field:=1, Criteria1:=Worksheets(“Sheet1”).Range(“j1”)
SON GÖRÜNTÜ AŞAIDADIR