Dear, apologies for the case since I find myself using the google translate.
I'm trying to export information from a gridview by adding to this headers and footer at the time of launching the xlsx, so following the thread http://docs.telerik.com/devtools/winforms/gridview/exporting-data/how -to / add-header-and-footer-to-the-exported-document, I have not been able to do it.
Attached code, please give me a hand. Thank you
Private
Sub
cmdExportarGestion_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
cmdExportarGestion.Click
'Try
Dim
sfd
As
New
FolderBrowserDialog()
Dim
ret
As
DialogResult
With
sfd
.Reset()
.Description =
" Seleccionar una carpeta "
.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
.ShowNewFolderButton =
False
ret = .ShowDialog()
End
With
If
ret = Windows.Forms.DialogResult.OK
Then
gbGeneral.Enabled =
False
Me
.Cursor = Cursors.WaitCursor
'For Each item In cboVendedores.Items
'CargarFDetallePorcentaje(dgExportar, cboGestiones.Text, item("CODIGO").ToString)
CargarFDetallePorcentaje(dgExportar, cboGestiones.Text, cboVendedores.Text)
Select
Case
chkCabeceras.CheckState
Case
CheckState.Checked
Dim
spreadExporter
As
New
GridViewSpreadExport(dgMaestroDetalle)
Dim
exportRenderer
As
New
SpreadExportRenderer()
AddHandler
exportRenderer.WorkbookCreated,
AddressOf
exportRenderer.CreateWorkbook
spreadExporter.SheetName =
"COMISION VENDEDOR 05"
spreadExporter.RunExport(sfd.SelectedPath &
"\123.xlsx"
, exportRenderer)
Dim
solidPatternFill
As
New
PatternFill(PatternType.Solid, System.Windows.Media.Color.FromRgb(46, 204, 113), Colors.Transparent)
Dim
textFormat
As
New
CellValueFormat(
"@"
)
Dim
workbook
As
New
Workbook()
'Dim worksheet As Worksheet = workbook.Worksheets.Add("COMISION")
Dim
worksheet
As
Worksheet = workbook.Sheets.Add(0)
'TryCast(workbook.Sheets(0), Worksheet)
Dim
range
As
New
CellRange(0, 0, 1, dgMaestroDetalle.Columns.Count - 4)
Dim
header
As
CellSelection = worksheet.Cells(range)
If
header.CanInsertOrRemove(range, ShiftType.Down)
Then
header.Insert(InsertShiftType.Down)
End
If
header.Merge()
header.SetFormat(textFormat)
header.SetHorizontalAlignment(Telerik.WinControls.UI.RadHorizontalAlignment.Center)
header.SetVerticalAlignment(Telerik.WinControls.UI.RadVerticalAlignment.Center)
header.SetFontFamily(
New
ThemableFontFamily(
"Rockwell"
))
header.SetFontSize(24)
header.SetFill(solidPatternFill)
header.SetValue(
"Nortwind Products Details"
)
Case
CheckState.Unchecked
'Dim spreadExporter As New ExportToExcelML(dgMaestroDetalle)
'spreadExporter.ExportHierarchy = True
'spreadExporter.ExportVisualSettings = True
'spreadExporter.RunExport(sfd.SelectedPath & "\Gestion_" & cboGestiones.Text & "_Vendedor_" & item("CODIGO").ToString & ".xls")
End
Select
'Next
Else
Exit
Sub
End
If
Me
.Cursor = Cursors.
Default
sfd.Dispose()
MsgBox(
"Exportacion exitosa.."
, MsgBoxStyle.Information, MsgboxTitle)
gbGeneral.Enabled =
True
'Catch ex As Exception
' MsgBox(ex.Message, MsgBoxStyle.Critical, MsgboxError)
'End Try
End
Sub
End
Class