From 26ae544565b1daae4205ca35b5a9bc14cf111fb6 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Mon, 30 Dec 2019 11:06:29 +0330 Subject: [PATCH 01/12] Excel Font Charset attribute supports --- EPPlus/Style/ExcelFont.cs | 17 ++++++++++++++++- EPPlus/Style/StyleChangeEventArgs.cs | 3 ++- EPPlus/Style/XmlAccess/ExcelFontXml.cs | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/EPPlus/Style/ExcelFont.cs b/EPPlus/Style/ExcelFont.cs index da090da2..2f57b9d7 100644 --- a/EPPlus/Style/ExcelFont.cs +++ b/EPPlus/Style/ExcelFont.cs @@ -90,6 +90,20 @@ public int Family } } /// + /// Font charset + /// + public int Charset + { + get + { + return _styles.Fonts[Index].Charset; + } + set + { + _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Charset, value, _positionID, _address)); + } + } + /// /// Cell color /// public ExcelColor Color @@ -222,13 +236,14 @@ public void SetFromFont(Font Font) Bold = Font.Bold; UnderLine = Font.Underline; Italic = Font.Italic; + Charset = Font.GdiCharSet; } internal override string Id { get { - return Name + Size.ToString() + Family.ToString() + Scheme.ToString() + Bold.ToString()[0] + Italic.ToString()[0] + Strike.ToString()[0] + UnderLine.ToString()[0] + VerticalAlign; + return Name + Size.ToString() + Family.ToString() + Charset.ToString() + Scheme.ToString() + Bold.ToString()[0] + Italic.ToString()[0] + Strike.ToString()[0] + UnderLine.ToString()[0] + VerticalAlign; } } } diff --git a/EPPlus/Style/StyleChangeEventArgs.cs b/EPPlus/Style/StyleChangeEventArgs.cs index 0dee887c..2a6c5c3f 100644 --- a/EPPlus/Style/StyleChangeEventArgs.cs +++ b/EPPlus/Style/StyleChangeEventArgs.cs @@ -91,7 +91,8 @@ internal enum eStyleProperty GradientRight, XfId, Indent, - QuotePrefix + QuotePrefix, + Charset } internal class StyleChangeEventArgs : EventArgs { diff --git a/EPPlus/Style/XmlAccess/ExcelFontXml.cs b/EPPlus/Style/XmlAccess/ExcelFontXml.cs index c3274398..6d620c47 100644 --- a/EPPlus/Style/XmlAccess/ExcelFontXml.cs +++ b/EPPlus/Style/XmlAccess/ExcelFontXml.cs @@ -48,6 +48,7 @@ internal ExcelFontXml(XmlNamespaceManager nameSpaceManager) _name = ""; _size = 0; _family = int.MinValue; + _charset = int.MinValue; _scheme = ""; _color = _color = new ExcelColorXml(NameSpaceManager); _bold = false; @@ -62,6 +63,7 @@ internal ExcelFontXml(XmlNamespaceManager nsm, XmlNode topNode) : _name = GetXmlNodeString(namePath); _size = (float)GetXmlNodeDecimal(sizePath); _family = GetXmlNodeIntNull(familyPath)??int.MinValue; + _charset = GetXmlNodeIntNull(charsetPath)??int.MinValue; _scheme = GetXmlNodeString(schemePath); _color = new ExcelColorXml(nsm, topNode.SelectSingleNode(_colorPath, nsm)); _bold = GetBoolValue(topNode, boldPath); @@ -142,6 +144,22 @@ public int Family _family=value; } } + const string charsetPath = "d:charset/@val"; + int _charset; + /// + /// Font Charset + /// + public int Charset + { + get + { + return (_charset == int.MinValue ? 1 : _charset); // DEFAULT Charset + } + set + { + _charset = value; + } + } ExcelColorXml _color = null; const string _colorPath = "d:color"; /// @@ -278,6 +296,7 @@ public void SetFromFont(System.Drawing.Font Font) Bold = Font.Bold; UnderLine=Font.Underline; Italic=Font.Italic; + Charset = Font.GdiCharSet; // default is 1 } public static float GetFontHeight(string name, float size) { @@ -332,6 +351,7 @@ internal ExcelFontXml Copy() newFont.Name = _name; newFont.Size = _size; newFont.Family = _family; + newFont.Charset = _charset; newFont.Scheme = _scheme; newFont.Bold = _bold; newFont.Italic = _italic; @@ -372,6 +392,7 @@ internal override XmlNode CreateXmlNode(XmlNode topElement) } if(!string.IsNullOrEmpty(_name)) SetXmlNodeString(namePath, _name); if(_family>int.MinValue) SetXmlNodeString(familyPath, _family.ToString()); + if(_charset>int.MinValue) SetXmlNodeString(charsetPath, _charset.ToString()); if (_scheme != "") SetXmlNodeString(schemePath, _scheme.ToString()); return TopNode; From 852020aee7f69a158b5b4d708a630579fea03672 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Mon, 30 Dec 2019 11:07:35 +0330 Subject: [PATCH 02/12] readme updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab0fc990..f905c6db 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# EPPlus +# EPPlus With Font Charset Support Create advanced Excel spreadsheets using .NET, without the need of interop. EPPlus is a .NET library that reads and writes Excel files using the Office Open XML format (xlsx). From 998b4ac8541853c5a8d95acc601daa37205c70ea Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Mon, 30 Dec 2019 17:45:50 +0330 Subject: [PATCH 03/12] Capability to access the formula tokenizer --- EPPlus/ExcelWorkbook.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EPPlus/ExcelWorkbook.cs b/EPPlus/ExcelWorkbook.cs index 0887bd35..37ae17f6 100644 --- a/EPPlus/ExcelWorkbook.cs +++ b/EPPlus/ExcelWorkbook.cs @@ -308,7 +308,7 @@ public ExcelNamedRangeCollection Names #region Workbook Properties decimal _standardFontWidth = decimal.MinValue; string _fontID = ""; - internal FormulaParser FormulaParser + public FormulaParser FormulaParser { get { From b37c25aae770b282e6c1433106266a715701b8bd Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Mon, 30 Dec 2019 17:46:03 +0330 Subject: [PATCH 04/12] my sample case --- SampleApp.Core/Sample17.cs | 127 ++++++++++++++++++++++++++++++++++ SampleApp.Core/Sample_Main.cs | 13 +++- 2 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 SampleApp.Core/Sample17.cs diff --git a/SampleApp.Core/Sample17.cs b/SampleApp.Core/Sample17.cs new file mode 100644 index 00000000..3bbd2ff8 --- /dev/null +++ b/SampleApp.Core/Sample17.cs @@ -0,0 +1,127 @@ +/******************************************************************************* + * You may amend and distribute as you like, but don't remove this header! + * + * All rights reserved. + * + * EPPlus is an Open Source project provided under the + * GNU General Public License (GPL) as published by the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * EPPlus provides server-side generation of Excel 2007 spreadsheets. + * See https://github.com/JanKallman/EPPlus for details. + * + * + * The GNU General Public License can be viewed at http://www.opensource.org/licenses/gpl-license.php + * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html + * + * The code for this project may be used and redistributed by any means PROVIDING it is + * not sold for profit without the author's written consent, and providing that this notice + * and the author's name and all copyright notices remain intact. + * + * All code and executables are provided "as is" with no warranty either express or implied. + * The author accepts no liability for any damage or loss of business that this product may cause. + * + * + * Code change notes: + * + * Author Change Date + ******************************************************************************* + * Jan Källman Added 10-SEP-2009 + *******************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Diagnostics; +using OfficeOpenXml; +using System.IO; +using System.Data.SqlClient; +using OfficeOpenXml.Drawing; +using OfficeOpenXml.Drawing.Chart; +using OfficeOpenXml.Style; +using System.Drawing; +using OfficeOpenXml.FormulaParsing.Excel.Functions; +using OfficeOpenXml.FormulaParsing.ExpressionGraph; +using OfficeOpenXml.FormulaParsing; +using System.Linq; + +namespace EPPlusSamples +{ + class EvaluateFunction : ExcelFunction + { + public override CompileResult Execute(IEnumerable arguments, ParsingContext context) + { + ValidateArguments(arguments, 1); + var args = arguments.ToArray(); + // renderer.customFunctionEvaluated = true; + + double? hasDefaultVal = null; + if (args.Length > 1 && args[1].Value is double) + { + hasDefaultVal = (double)args[1].Value; + } + return new CompileResult(args[0].Value.ToString(), DataType.String); + } + } + class Sample17 + { + /// + /// This sample creates a new workbook from a template file containing a chart and populates it with Exchangrates from + /// the Adventureworks database and set the three series on the chart. + /// + /// Connectionstring to the Adventureworks db + /// the template + /// output dir + /// + public static string RunSample17(FileInfo template) + { + using (var stream = File.Open(template.FullName, FileMode.Open)) + using (ExcelPackage p = new ExcelPackage(stream)) + { + p.Workbook.FormulaParserManager.AddOrReplaceFunction("e", new EvaluateFunction()); + //Set up the headers + ExcelWorksheet ws = p.Workbook.Worksheets[0]; + for (int i=1; i<= ws.Dimension.Rows; i++) + { + for (int j=1; j<=ws.Dimension.Columns; j++) + { + var cell = ws.Cells[i, j]; + if (cell.Merge) + continue; + var val = ws.Cells[i, j].Value; + var formual = ws.Cells[i, j].Formula; + if (!string.IsNullOrEmpty(formual)) + { + var result = p.Workbook.FormulaParserManager.Parse(formual); + var val2 = ws.Calculate(formual); + ws.Cells[i, j].Formula = string.Empty; + ws.Cells[i, j].Value = val2; + Console.WriteLine($"{i},{j}: {val} and f={formual} and eval={val2}"); + } + } + } + p.Workbook.Worksheets[0].Select(); + + foreach (var a in ws.MergedCells) + { + var cell = ws.Cells[a]; + var formual = cell.Formula; + if (!string.IsNullOrEmpty(formual)) + { + var tokens = p.Workbook.FormulaParser.Lexer.Tokenize(formual); + //var result = p.Workbook.FormulaParserManager.Parse(); + var val2 = ws.Calculate(formual); + cell.Formula = string.Empty; + cell.Value = val2; + Console.WriteLine($"{cell.Value} and f={formual} and eval={val2}"); + } + } + Byte[] bin = p.GetAsByteArray(); + + FileInfo file = Utils.GetFileInfo("sample17.xlsx"); + File.WriteAllBytes(file.FullName, bin); + return file.FullName; + } + } + } +} \ No newline at end of file diff --git a/SampleApp.Core/Sample_Main.cs b/SampleApp.Core/Sample_Main.cs index bcc38404..668f0a26 100644 --- a/SampleApp.Core/Sample_Main.cs +++ b/SampleApp.Core/Sample_Main.cs @@ -38,10 +38,21 @@ namespace EPPlusSamples { class Sample_Main { + static void Test() + { + Console.WriteLine("Running sample 4"); + var sample17Path = Sample17.RunSample17(new FileInfo(@"C:\Users\mohammad\Desktop\DailyReportTemplate-v2.xlsx")); //Template path from /bin/debug or /bin/release + Console.WriteLine("Sample 17 created: {0}", sample17Path); + Console.WriteLine(); + } static void Main(string[] args) { + try { + Utils.OutputDir = new DirectoryInfo($"{AppDomain.CurrentDomain.BaseDirectory}SampleApp"); + Test(); + return; //Sample 3, 4 and 12 uses the Adventureworks database. Enter the connectionstring to the Adventureworks database(2016 CTP3) into the variable below... //Leave this blank if you don't have access to the Adventureworks database string connectionStr = ""; //for example "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AdventureWorks2016CTP3;Data Source=MySqlServer" @@ -177,7 +188,7 @@ static void Main(string[] args) } var prevColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine($"Genereted sample workbooks can be found in {Utils.OutputDir.FullName}"); + Console.WriteLine($"Genereted sample workbooks can be found in {Utils.OutputDir?.FullName}"); Console.ForegroundColor = prevColor; Console.WriteLine(); From 1b271cc86feb586cc49b385f3677ece938a97700 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Mon, 30 Dec 2019 17:46:30 +0330 Subject: [PATCH 05/12] upgrade version --- EPPlus/EPPlus.MultiTarget.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EPPlus/EPPlus.MultiTarget.csproj b/EPPlus/EPPlus.MultiTarget.csproj index 840a07b2..2c656d66 100644 --- a/EPPlus/EPPlus.MultiTarget.csproj +++ b/EPPlus/EPPlus.MultiTarget.csproj @@ -2,9 +2,9 @@ netcoreapp2.1;netstandard2.0;net35;net40 - 4.5.3.2 - 4.5.3.2 - 4.5.3.2 + 4.5.3.4 + 4.5.3.4 + 4.5.3.4 true https://licenses.nuget.org/LGPL-3.0-or-later https://github.com/JanKallman/EPPlus @@ -17,7 +17,7 @@ Excel ooxml Jan Källman 2018 - EPPlus 4.5.3.2 + EPPlus 4.5.3.4 New features in version 4.5: * .NET Core support From 9ae38558be5ee593442c921294695a76b589fb8d Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Tue, 4 Feb 2020 10:03:35 +0330 Subject: [PATCH 06/12] core 3.1 added --- EPPlus/EPPlus.MultiTarget.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EPPlus/EPPlus.MultiTarget.csproj b/EPPlus/EPPlus.MultiTarget.csproj index 2c656d66..80a34330 100644 --- a/EPPlus/EPPlus.MultiTarget.csproj +++ b/EPPlus/EPPlus.MultiTarget.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;netstandard2.0;net35;net40 + netcoreapp3.1;netcoreapp2.1;netstandard2.0;net35;net40 4.5.3.4 4.5.3.4 4.5.3.4 From 7c7e438a6fa33b872c1d22b7ea4523141e90acf4 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Tue, 4 Feb 2020 10:22:36 +0330 Subject: [PATCH 07/12] core 3.1 added --- EPPlus/EPPlus.MultiTarget.csproj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/EPPlus/EPPlus.MultiTarget.csproj b/EPPlus/EPPlus.MultiTarget.csproj index 80a34330..12bdac3b 100644 --- a/EPPlus/EPPlus.MultiTarget.csproj +++ b/EPPlus/EPPlus.MultiTarget.csproj @@ -235,6 +235,10 @@ Release Candidate changes Core + + Core + + NET35;NETFULL @@ -301,6 +305,13 @@ Release Candidate changes + + + + + + + From cc1c3193f6af110ce5ab1df52af40d5f55b14b18 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Tue, 4 Feb 2020 10:39:33 +0330 Subject: [PATCH 08/12] core 3.1 released --- EPPlus/EPPlus.MultiTarget.csproj | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/EPPlus/EPPlus.MultiTarget.csproj b/EPPlus/EPPlus.MultiTarget.csproj index fdcf2d62..48aab176 100644 --- a/EPPlus/EPPlus.MultiTarget.csproj +++ b/EPPlus/EPPlus.MultiTarget.csproj @@ -1,10 +1,11 @@  - netcoreapp3.1;netcoreapp2.1;netstandard2.0;net35;net40 - 4.5.3.4 - 4.5.3.4 - 4.5.3.4 + + netcoreapp3.1 + 4.5.3.5 + 4.5.3.5 + 4.5.3.5 true https://github.com/JanKallman/EPPlus @@ -325,11 +326,19 @@ Release Candidate changes - - + + + + + 4.7.0 + + + + - - + + + From 8bdedb070f76b7a0a7c6da9b267d7d5a529ac401 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Tue, 18 Feb 2020 12:19:03 +0330 Subject: [PATCH 09/12] external reference bug resolved --- EPPlus/ExcelWorkbook.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EPPlus/ExcelWorkbook.cs b/EPPlus/ExcelWorkbook.cs index 37ae17f6..29cd989c 100644 --- a/EPPlus/ExcelWorkbook.cs +++ b/EPPlus/ExcelWorkbook.cs @@ -1111,7 +1111,7 @@ internal void GetExternalReferences() XmlElement book=xmlExtRef.SelectSingleNode("//d:externalBook", NameSpaceManager) as XmlElement; if(book!=null) { - string rId_ExtRef = book.GetAttribute("r:id"); + string rId_ExtRef = book.GetAttribute("id", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); var rel_extRef = part.GetRelationship(rId_ExtRef); if (rel_extRef != null) { From 7e67f9beb7ab6de350fdf8be3c488c813f91ac8f Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Tue, 18 Feb 2020 12:19:22 +0330 Subject: [PATCH 10/12] external invalid reference fixed --- EPPlus/ExcelAddress.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EPPlus/ExcelAddress.cs b/EPPlus/ExcelAddress.cs index 651dfbe1..9e60309e 100644 --- a/EPPlus/ExcelAddress.cs +++ b/EPPlus/ExcelAddress.cs @@ -892,7 +892,7 @@ internal enum AddressType internal static AddressType IsValid(string Address, bool r1c1=false) { double d; - if (Address == "#REF!") + if (Address == "#REF!" || Address == "'#REF'!#REF!") { return AddressType.Invalid; } From 7fe434a8454b2e61394c7d4a051fc292dca433c3 Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Tue, 18 Feb 2020 12:19:56 +0330 Subject: [PATCH 11/12] some interface required --- EPPlus/EPPlus.MultiTarget.csproj | 6 +++--- EPPlus/FormulaParsing/ExcelValues.cs | 6 +++--- SampleApp.Core/SampleApp.Core.csproj | 2 +- SampleApp.Core/Sample_Main.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/EPPlus/EPPlus.MultiTarget.csproj b/EPPlus/EPPlus.MultiTarget.csproj index 48aab176..761d3612 100644 --- a/EPPlus/EPPlus.MultiTarget.csproj +++ b/EPPlus/EPPlus.MultiTarget.csproj @@ -3,9 +3,9 @@ netcoreapp3.1 - 4.5.3.5 - 4.5.3.5 - 4.5.3.5 + 4.5.3.7 + 4.5.3.7 + 4.5.3.7 true https://github.com/JanKallman/EPPlus diff --git a/EPPlus/FormulaParsing/ExcelValues.cs b/EPPlus/FormulaParsing/ExcelValues.cs index 48e9d489..ee387b90 100644 --- a/EPPlus/FormulaParsing/ExcelValues.cs +++ b/EPPlus/FormulaParsing/ExcelValues.cs @@ -128,12 +128,12 @@ public static eErrorType ToErrorType(string val) } } - internal static ExcelErrorValue Create(eErrorType errorType) + public static ExcelErrorValue Create(eErrorType errorType) { return new ExcelErrorValue(errorType); } - internal static ExcelErrorValue Parse(string val) + public static ExcelErrorValue Parse(string val) { if (Values.StringIsErrorValue(val)) { @@ -143,7 +143,7 @@ internal static ExcelErrorValue Parse(string val) throw new ArgumentException("Not a valid error value: " + val); } - private ExcelErrorValue(eErrorType type) + public ExcelErrorValue(eErrorType type) { Type=type; } diff --git a/SampleApp.Core/SampleApp.Core.csproj b/SampleApp.Core/SampleApp.Core.csproj index 4373a198..61be8991 100644 --- a/SampleApp.Core/SampleApp.Core.csproj +++ b/SampleApp.Core/SampleApp.Core.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + netcoreapp3.1 diff --git a/SampleApp.Core/Sample_Main.cs b/SampleApp.Core/Sample_Main.cs index 668f0a26..95c07715 100644 --- a/SampleApp.Core/Sample_Main.cs +++ b/SampleApp.Core/Sample_Main.cs @@ -41,7 +41,7 @@ class Sample_Main static void Test() { Console.WriteLine("Running sample 4"); - var sample17Path = Sample17.RunSample17(new FileInfo(@"C:\Users\mohammad\Desktop\DailyReportTemplate-v2.xlsx")); //Template path from /bin/debug or /bin/release + var sample17Path = Sample17.RunSample17(new FileInfo(@"C:\Users\mohammad\Documents\Projects\DMS2\codes\backend\Infrastructure\XLSConverter\bin\Debug\132264854811994556.xlsx")); //Template path from /bin/debug or /bin/release Console.WriteLine("Sample 17 created: {0}", sample17Path); Console.WriteLine(); } From b38f9f9ac9f9508911083a631407976e03d4345a Mon Sep 17 00:00:00 2001 From: zatkhahi Date: Sat, 29 Feb 2020 14:19:30 +0330 Subject: [PATCH 12/12] bug resolved --- EPPlus/EPPlus.MultiTarget.csproj | 6 +++--- EPPlus/ExcelAddress.cs | 2 +- SampleApp.Core/Sample17.cs | 2 ++ SampleApp.Core/Sample_Main.cs | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/EPPlus/EPPlus.MultiTarget.csproj b/EPPlus/EPPlus.MultiTarget.csproj index 761d3612..05ca3fd5 100644 --- a/EPPlus/EPPlus.MultiTarget.csproj +++ b/EPPlus/EPPlus.MultiTarget.csproj @@ -3,9 +3,9 @@ netcoreapp3.1 - 4.5.3.7 - 4.5.3.7 - 4.5.3.7 + 4.5.3.8 + 4.5.3.8 + 4.5.3.8 true https://github.com/JanKallman/EPPlus diff --git a/EPPlus/ExcelAddress.cs b/EPPlus/ExcelAddress.cs index 9e60309e..ec344102 100644 --- a/EPPlus/ExcelAddress.cs +++ b/EPPlus/ExcelAddress.cs @@ -892,7 +892,7 @@ internal enum AddressType internal static AddressType IsValid(string Address, bool r1c1=false) { double d; - if (Address == "#REF!" || Address == "'#REF'!#REF!") + if (Address == "#REF!" || Address == "'#REF'!#REF!" || Address.StartsWith("#REF!")) { return AddressType.Invalid; } diff --git a/SampleApp.Core/Sample17.cs b/SampleApp.Core/Sample17.cs index 3bbd2ff8..3d7e1df3 100644 --- a/SampleApp.Core/Sample17.cs +++ b/SampleApp.Core/Sample17.cs @@ -79,6 +79,8 @@ public static string RunSample17(FileInfo template) using (ExcelPackage p = new ExcelPackage(stream)) { p.Workbook.FormulaParserManager.AddOrReplaceFunction("e", new EvaluateFunction()); + var sheet = p.Workbook.Worksheets.FirstOrDefault(); + var resultFormula = sheet.Calculate("J23+J21+J13+J14+J22"); //Set up the headers ExcelWorksheet ws = p.Workbook.Worksheets[0]; for (int i=1; i<= ws.Dimension.Rows; i++) diff --git a/SampleApp.Core/Sample_Main.cs b/SampleApp.Core/Sample_Main.cs index 95c07715..fa813065 100644 --- a/SampleApp.Core/Sample_Main.cs +++ b/SampleApp.Core/Sample_Main.cs @@ -41,7 +41,7 @@ class Sample_Main static void Test() { Console.WriteLine("Running sample 4"); - var sample17Path = Sample17.RunSample17(new FileInfo(@"C:\Users\mohammad\Documents\Projects\DMS2\codes\backend\Infrastructure\XLSConverter\bin\Debug\132264854811994556.xlsx")); //Template path from /bin/debug or /bin/release + var sample17Path = Sample17.RunSample17(new FileInfo(@"C:\Users\mohammad\Documents\Projects\DMS2\codes\frontend\DMS\Api Tests\Planning\Exports\Files\Export2.xlsx")); //Template path from /bin/debug or /bin/release Console.WriteLine("Sample 17 created: {0}", sample17Path); Console.WriteLine(); }