When downloading the excel I have to configure the blocking options to be able to edit on the excel.
Configuring the following:
Click on the red circle
There is some property to enable from the code, so that when downloading the excel you can manipulate the information,
without having to make those configurations as shown in the images.
Code
Private Sub btnexcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexcel.Click
'Convertir a Excel
'-------------------------------------
Try
Dim filename As String = "report" & DateTime.Now.Ticks.ToString & ".xls"
Dim stream As New FileStream(filename, FileMode.OpenOrCreate)
Dim ex As New ExcelWriter(stream)
ex.BeginWrite()
'----------------------------------------------
'Obtiene los nombres de las columnas
'----------------------------------------------
Dim name(dtaasistencia.Columns.Count) As String
Dim i As Integer = 0
For Each column As DataColumn In dt.Columns
name(i) = column.ColumnName
ex.WriteCell(0, i, name(i))
i += 1
Next
Dim conta As Integer = 1
For Each row As DataGridViewRow In dtaasistencia.Rows
If Not row.IsNewRow Then
If row.Cells(0).Value.ToString <> "" Then
For ci = 0 To i - 1
ex.WriteCell(conta, ci, row.Cells(ci).Value.ToString)
Next
conta = conta + 1
End If
End If
Next
ex.EndWrite()
stream.Close()
System.Diagnostics.Process.Start(filename)
Catch ex As Exception
MessageBox.Show("Error al Generar el Excel ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End Sub