
problema con SpreadsheetLight (3.5.0) y DocumentFormat.OpenXml (2.12.0)
Publicado por Jaziel (1 intervención) el 14/10/2022 18:44:47
Estaba haciendo una practica para leer y editar un excel con los Nugets dichos en el titulo y me arroja el error: System.IO.IOException: 'Entries cannot be opened multiple times in Update mode #909
Muchas gracias de antemano
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
private void Excellista()
{
SLDocument sl = new SLDocument(ruta);
DateTime mes = DateTime.Today;
sl.SetCellValue("D3","MES: "+ mes.ToString("MMMM"));
sl.SetCellValue("D4","AÑO ESCOLAR: "+ mes.ToString("yyyy"));
Conexion conecta = new Conexion();
MySqlConnection sqlCnn = new MySqlConnection(Conexion.cadena);
sqlCnn.Open();
string sql = "select Genero, Nombre, ApellidoP, ApellidoM from alumno;";
int celdaContenido = 8;
MySqlCommand comando = new MySqlCommand(sql, sqlCnn);
MySqlDataReader reader = comando.ExecuteReader();
while (reader.Read())
{
sl.SetCellValue("C" + celdaContenido, reader["Genero"].ToString());
sl.SetCellValue("D" + celdaContenido, reader["Nombre"].ToString() + " " + reader["ApellidoP"].ToString() + " " + reader["ApellidoM"].ToString());
celdaContenido++;
}
SaveFileDialog guardar = new SaveFileDialog();
guardar.Filter = "Libro de Excel|*.xlsx";
guardar.Title = "Guardar Reporte";
guardar.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
if(guardar.ShowDialog() == DialogResult.OK)
{
sl.SaveAs(guardar.FileName);
MessageBox.Show("Archivo guardado");
}
}
Muchas gracias de antemano
Valora esta pregunta


0