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

Array formulas lost when using a template

Aug 31, 2011 at 9:42 PM
Edited Aug 31, 2011 at 11:23 PM

Hi all,

First of all I'd like to thank you for your amazing job. Epplus is a really usefull tool.

I'm opening this discussion to focus on array formulas; not creating them using eeplus but having a template that have them processed by eeplus.

The steps to reproduce the error is:

 

1 - Create a .xlsx file with an arbitrary number of sheets;

2 - Put an array formula in one cell of one sheet

3 - Process the file using it as a template (new ExcelPackage(new FileInfo(path), new FileInfo(templatePath))) and insert an abitrary number of rows on any sheet (not necessarily the sheet containing the array formula)

4 - The resulting file got its array formulas transformed into regular formulas (which, obviously, don't work anymore)

 

The expected result was to have the formulas intact, since no change was made to the whole sheet (let alone the particular cell containing the array formula)

 

Moreover, and I don't know if its supposed to, I checkout the trunk and I got a lot of XML errors while saving the package. I know that the trunk isn't supposed to work all the time but I'm giving the heads up anyway. BTW, I checked it out to see if this whole array formulas being transformed in regular formulas problem was already solved.

 

Did anyone run into this problem as well? Is there a solution/workaround?

 

I'm using epplus 2.9.0.1 (from here: http://epplus.codeplex.com/releases/view/67324#DownloadId=245824)


Best,

Gonçalo

Coordinator
Sep 1, 2011 at 6:32 PM

Ok, I'll have a look at it. I'll get back to you when I have a solution.

Jan

Sep 2, 2011 at 2:16 PM

Hi Jan,

 

Thanks for  your reply, sounds perfect.

 

I don't know if it helps, but the same happens with cell properties, border, diagonal. That is, if I set regular (horizontal,vertical) cell borders it works ok but any cells with diagonal border appears without it in the processed file.

 

Best,

Gonçalo

Feb 21, 2013 at 7:08 AM
Any news or correction about this bug ?
Or do you know any tricks allowing to bypass it.

I have the same problem in Version 3.0.0.2

Regards,

Georges
Apr 29, 2014 at 5:04 AM
Edited Apr 29, 2014 at 5:09 AM
ExcelBorderXml.cs File Modify(version beta 4.02)

before

internal ExcelBorderXml(XmlNamespaceManager nsm, XmlNode topNode) : base(nsm, topNode)
        {
            _left = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(leftPath, nsm));
            _right = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(rightPath, nsm));
            _top = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(topPath, nsm));
            _bottom = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(bottomPath, nsm));
            _diagonal = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(diagonalPath, nsm));
        }

after

internal ExcelBorderXml(XmlNamespaceManager nsm, XmlNode topNode) : base(nsm, topNode)
        {
            _left = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(leftPath, nsm));
            _right = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(rightPath, nsm));
            _top = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(topPath, nsm));
            _bottom = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(bottomPath, nsm));
            _diagonal = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(diagonalPath, nsm));


            /* Get the diagonal part of a bug in the process as follows: Start */
            foreach (XmlAttribute attr in topNode.Attributes) 
            {
                switch (attr.Name)
                {
                    case "diagonalDown":
                        this.DiagonalDown = true;
                        break;
                    case "diagonalUp":
                        this.DiagonalUp = true;
                        break;
                }
            }
            /* Get the diagonal part of a bug in the process as follows: End */
        }