Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: Remote Registration of NetOffice Assemblies

$
0
0
Hi,

had nearly the same experience:
A method that defines a variable of type NetOffice.ExcelApi._WorkSheet fails on one computer (Win2012 x64 with Office 2016 x64):
        private bool hasSheet(string sheetName)
        {
            bool hasSheet = false;
            foreach (NetOffice.ExcelApi._Worksheet sheet in excelWorkbook.Worksheets)
            {
                if (sheet.Name.Equals(sheetName, StringComparison.InvariantCultureIgnoreCase))
                {
                    hasSheet = true;
                    break;
                }
            }
            return hasSheet;
        }
After searching google a long time (and found nothing) I changed my code in order to prevent using a reference to this type...
        private bool hasSheet(string sheetName)
        {
            bool hasSheet = false;
            try
            {
                var sheet = excelWorkbook.Sheets[sheetName];
                hasSheet = true;
            }
            catch (Exception ex)
            {
                Logger4net.Log("Sheet '{0}' does not exist in workbook", Logger4net.LoggerMsgType.ERROR, ex);
            }
            return hasSheet;
        }
HTH,
Karsten

Viewing all articles
Browse latest Browse all 1741

Trending Articles