EPPlus loses row height

I need to use existing excel and place content on specific cells and serve it to the user via ASP.Net MVC site. The original excel should not be modified to be used as a template. The problem is that functionally everything works with EPPlus, the height of the original excel lines is completely lost as a result of excel.

using (ExcelPackage package = new ExcelPackage(new FileInfo(NewFile), new FileInfo(Template)))
         {
            ExcelWorksheet excelSheet = package.Workbook.Worksheets[1];
            //Do all process, mainly set specific cell values
            package.Save();
         }
         //Return the new file to user

      

+3


source to share


1 answer


I always make a copy of my file rather than opening any file I want to leave unchanged. I would try:



File.Copy(originalTemplate, workingTemplate, true);
using (ExcelPackage package = new ExcelPackage(new FileInfo(NewFile), new FileInfo(workingTemplate)))
     {
        ExcelWorksheet excelSheet = package.Workbook.Worksheets[1];
        //Do all process, mainly set specific cell values
        package.Save();
     }
     //Return the new file to user

      

0


source







All Articles