From 30af89b49f2976d254e454fdf5cd93b100b254c7 Mon Sep 17 00:00:00 2001 From: mohanji Date: Fri, 25 Jan 2019 14:43:04 +0530 Subject: [PATCH] Update ExcelWorkbook.cs Null check is needed.. added because NameValue is some times null hence it could not able to save the xlsm files. --- EPPlus/ExcelWorkbook.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EPPlus/ExcelWorkbook.cs b/EPPlus/ExcelWorkbook.cs index ae05fc7..06f313b 100644 --- a/EPPlus/ExcelWorkbook.cs +++ b/EPPlus/ExcelWorkbook.cs @@ -4,7 +4,7 @@ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets. * See http://www.codeplex.com/EPPlus for details. * - * Copyright (C) 2011 Jan Källman + * Copyright (C) 2011 Jan Källman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,8 +26,8 @@ * * Author Change Date * ****************************************************************************** - * Jan Källman Initial Release 2011-01-01 - * Jan Källman License changed GPL-->LGPL 2011-12-27 + * Jan Källman Initial Release 2011-01-01 + * Jan Källman License changed GPL-->LGPL 2011-12-27 *******************************************************************************/ using System; using System.Xml; @@ -890,7 +890,7 @@ private void SetNameElement(ExcelNamedRange name, XmlElement elem) { if (name.IsName) { - if (string.IsNullOrEmpty(name.NameFormula)) + if (string.IsNullOrEmpty(name.NameFormula)&& name.NameValue != null) { if ((name.NameValue.GetType().IsPrimitive || name.NameValue is double || name.NameValue is decimal)) {