This project has moved. For the latest updates, please go here.

Worksheet Formatting Corruption

Dec 9, 2013 at 4:04 PM
I'm not sure if the right place to put this is in issues or discussions, but I'm putting it in both places for references. The Issue I created can be found here: https://epplus.codeplex.com/workitem/14927. It also has an attachment example.

I am hitting an issue where the Worksheet formatting is being corrupted after I open, make a small change, then re-save a sheet.

Here is the example code:
        public static void TestExcelOutput()
        {
            var path =
                @"C:\Users\bill\Documents\Visual Studio 2010\Projects\EPPlusTest\EPPlusTest\Input.xlsx";
            var inputFileInfo = new FileInfo(path);

            var outputPath = Path.Combine(Path.GetDirectoryName(path), string.Format("{0}{1}.{2}", Path.GetFileNameWithoutExtension(path),
                                          "-processed", Path.GetExtension(path)));
            var outputFileInfo = new FileInfo(outputPath);

            using (var package = new ExcelPackage(inputFileInfo))
            {
                foreach (var worksheet in package.Workbook.Worksheets)
                {
                    worksheet.SetValue(1, 1, "foo");
                }
                package.SaveAs(outputFileInfo);
            }

        }
For me, after re-saving, some of the cell borders in the Analyst tab are lost.