Giter Site home page Giter Site logo

epplussoftware / epplus Goto Github PK

View Code? Open in Web Editor NEW
1.7K 50.0 265.0 19.6 MB

EPPlus-Excel spreadsheets for .NET

Home Page: https://epplussoftware.com

License: Other

C# 100.00% Smalltalk 0.01%
net netframework netcore netstandard excel spreadsheet ooxml epplus

epplus's People

Contributors

adaneam avatar adrianepplus avatar ariesy avatar aschey avatar aurelianus avatar bluetianx avatar colbybhearn avatar drcolombo avatar haalepplus avatar hedda231 avatar heddaepplus avatar jankallman avatar karlkallman avatar kidgb avatar kolthor avatar leecannon avatar leifjones avatar lifefreedom avatar luuminhsam avatar machuga14 avatar marodev avatar meigyoku-thmn avatar nickbarrett avatar ossianepplus avatar raboud avatar rdhasse avatar soarc avatar swmal avatar twaltari avatar zal133 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epplus's Issues

InsertRow / DeleteRow / InsertColumn / DeleteColum do not update formulas on other sheets

To reproduce:

        [TestMethod]
        public void DeleteIssue()
        {
            using (var p = new ExcelPackage())
            {
                var ws1 = p.Workbook.Worksheets.Add("Sheet1");
                var ws2 = p.Workbook.Worksheets.Add("Sheet2");
                ws1.Cells["A10"].Value = 1;
                ws1.Cells["A11"].Formula = "A10*2";
                ws1.Cells["A12"].Value = 3;
                ws2.Cells["A1"].Formula = "SUM(Sheet1!A10:A12)";
                ws1.DeleteRow(1);
                Assert.AreEqual("A9*2",ws1.Cells["A10"].Formula);
                Assert.AreEqual("SUM(Sheet1!A9:A11)",ws2.Cells["A1"].Formula);
            }
        }

Formulas containing 'R' column cells being re-written with '$'

I have a worksheet that has been working perfectly for a few years. We just upgraded to 4.5.3.3 and now SUM formulas that contain a reference to a cell in column 'R' are being modified at some point in the writing of the spreadsheet.

I'm using Worksheet.Cells(Row, Column).Address to get the values for my SUM ranges. However, in testing, I'm just hard-coding the values and the same behavior occurs.

Examples:
sum(R16:R35) => sum($16:$35) when I write to the formula of the cell
sum(S16:S35) is correctly written
sum(R16:S16) => causes error and excel removes from spreadsheet. Assuming it is written as sum($16:S16)
sum(Q16:S16) is correctly written
Average(R16:R35) => Average($16:$35)

If I write my formulas to the value property of the cell it is written correctly.

What is so magical about the value of 'R'? Can I escape the value so it works? I cannot exclude that column because our data might required that we use that column.

Looks like our option at this time to roll back to the previous version?

RichText causes xml "corruption"

Its not exactly corrupt, but excel complains when opening.
"We found a problem with some content in yourfile.xlsx. Do you want us to try to recover as much as we can? if you trust the source of this workbook, click yes"
After repairing a window reports
"Repaired Records: String properties from /xl/sharedStrings.xml part (Strings)"
Version 5.0.3 (the current nuget)
It looks similar to 559 on the original git, and seen similar issues when googling but no solution.

I use this code to generate the spreadsheet, and it is when the richtext section is used that the problem occurs. (it generated 18 sections of rich text in that cell)

the two different sharedstring.xml files are attached
sharedstrings.zip

`var text = log.Text.Replace('\t', ' ');
var textCell = worksheet.Cells[rowindex, 4];

                    if (regexHighlight.Any(r => r.IsMatch(text)))
                    {
                        textCell.IsRichText = true;
                        foreach (var s in text.Split(' '))
                        {
                            var highlight = regexHighlight.Any(r => r.IsMatch(s));
                            var richText = textCell.RichText.Add(s);
                            richText.Bold = highlight;
                            richText.Color = highlight ? Color.Red : Color.Black;
                            textCell.RichText.Add(" ");
                        }
                    }
                    else
                    {
                        textCell.Value = log.Text.Replace('\t', ' ');
                    }`

Add support for fileSharing tag to protect workbooks (set readonly).

Password protection for a readonly copy of a package can be added using the workbookXml - fileSharing tag
Example:
<fileSharing spinCount="100000" saltValue="Yvt/UWxzbiieUg7qdhlAng==" hashValue="os7WY7CE0OjFKJ4p2bDsl7O8R6JtlEE6tKrHjPEAYwxMB1YYz9MZ9Yj45loZ1sxEjiZ6yEk0iBnY8JvPEKpj8w==" algorithmName="SHA-512" userName="Jan Källman" readOnlyRecommended="1"/>
This can be set in the save dialog in Excel --> Tools --> General options.

Formula parser fixes

This issue will cover some bugs, features with the formula parser of EPPlus (tokenizing and calculation).

  • Handle double negators (--) correctly.
  • Value matcher should compare DateTime and double
  • CountIf does not work properly with multiple conditions.

Chart series validation

Chart series will from version 5 handles both addresses and arrays. Arrays are handled in the StringLiteralsX, NumberLiteralsX and NumberLiteralsY arrays when a series is set to an Array ( for example {1,2,3} ).

TokenHandler uses static TokenSeparatorHandler which ignores custom ITokenSeparatorProvider

Original issue: JanKallman/EPPlus#628

The TokenHandler class calls the static TokenSeparatorHandler.Handle method inside its Handle method

        private void Handle()
        {
            var c = _context.FormulaChars[_tokenIndex];
            Token tokenSeparator;
            if (CharIsTokenSeparator(c, out tokenSeparator))
            {
                if (TokenSeparatorHandler.Handle(c, tokenSeparator, _context, this))
                {
                    return;
                }

The Handle method uses a static collection which contains a MultipleCharSeparatorHandler instance

        private static SeparatorHandler[] _handlers = new SeparatorHandler[]
        { 
            new StringHandler(),
            new BracketHandler(),
            new SheetnameHandler(),
            new MultipleCharSeparatorHandler()
        };

This causes the constructor of MultipleCharSeparatorHandler to use the default TokenSeparatorProvider anyway

        public MultipleCharSeparatorHandler()
            : this(new TokenSeparatorProvider())
        {

        }

This means that it does not use the ITokenSeparatorProvider that was provided initially to the TokenHandler. e.g.

   ITokenSeparatorProvider myTokenSeparatorProvider = new MyTokenSeparatorProvider();

   var tokenFactory = new TokenFactory(myTokenSeparatorProvider, NameValueProvider.Empty, 

   FunctionNameProvider.Empty, false);
   var tokenizer = new SourceCodeTokenizer(tokenFactory, myTokenSeparatorProvider);

Suggested solution:

TokenSeparatorHandler should be non-static and accept a ITokenSeparatorProvider in its constructor to pass on to MultipleCharSeparatorHandler.

TokenHandler should initialize it inside its constructor also passing the ITokenSeparatorProvider
e.g.

         public TokenSeparatorHandler(ITokenSeparatorProvider tokenSeparatorProvider)
	 {
		    _handlers = new SeparatorHandler[]
			{
				new StringHandler(),
				new BracketHandler(),
				new SheetnameHandler(),
				new MultipleCharSeparatorHandler(tokenSeparatorProvider)
			};
	 }

         public TokenHandler(TokenizerContext context, ITokenFactory tokenFactory, 
         ITokenSeparatorProvider tokenProvider)
        {
            _context = context;
            _tokenFactory = tokenFactory;
            _tokenProvider = tokenProvider;
            _tokenSeparatorHandler = new TokenSeparatorHandler(_tokenProvider);

Row cannot be less than 1. Parameter name: value

I have an excel that has some formatting (merged cells, formulas...etc.). You can find a copy of this excel attached. Im restricted with this format as its provided by the client and cannot be changed. Im using the EPPlus (version 4.5.3.3) to populate rows starting from row 8 but Im trying to use the worksheet.InsertRow(8,recordCounter,8) to create a new row for each inserted record and copy all styles as well from the first row, however I keep getting the following exception:
Row cannot be less than 1. Parameter name: value
MyExcel.xlsx

Handling of circular references

The handling of circular references needs a redesign for the following reasons:

  • Currently a CircularReferenceException is always thrown when the formula engine detects a circular reference during construction of the dependency chain. We want to move the logic for throwing this exception downstream to the compiler so that it only is thrown when Calculate is called.

  • Some functions should be able to ignore if a circular reference occurs.

Chart styles differ for single and multi series charts

Add a new enum ePresetMultiSeriesChartStyle for charts with more than one series. Preset Chart styles can differ depending if the chart has a single data serie or multiple data series.
Add a new overload to ChartStyleManager.SetChartStyle with the new enum

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.