when I write a file with this code it automatically occupies a "general" format to write it, the problem is that if I want to write numbers that start with 0 it automatically omits it, for example if I want to write 0123445 it will save me 12345 how can I write the cell with a specific format from c#
Excel.Application archivoxlsx = new Microsoft.Office.Interop.Excel.Application();
Excel.Workbook libro = archivoxlsx.Workbooks.Open("c:/Users/Edgar/Desktop/base/Libro1.xlsx", 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, true, 0, true, false, false);
Excel.Worksheet hoja = (Excel.Worksheet)libro.Worksheets.get_Item("Hoja1");
hoja.Cells[v,h] = cadena;
libro.Save();
libro.Close();
You could format the cell as text before assigning the value
I understand that he
NumberFormat
applies to a Range, but if you can dowould also be valid
How to format an Excel file using C#
How can i change the text format of an Excel Cell using C#?