Example #1
0
            /// <summary>
            /// Logs messages using NotificationReceiver
            /// </summary>
            /// <param name="fileName"></param>
            public static void LoggerWithManualExceptionHandling(string fileName)
            {
                //ExStart:LoggerWithManualExceptionHandling
                //get file actual path
                String      filePath    = Common.GetFilePath(fileName);
                var         receiver    = new NotificationReceiver();
                LoadOptions loadOptions = new LoadOptions();

                loadOptions.NotificationReceiver = receiver;

                try
                {
                    using (var extractor = new CellsTextExtractor(filePath, loadOptions))
                    {
                        Console.WriteLine(extractor.ExtractAll());
                    }
                }
                catch (Exception ex)
                {
                    receiver.ProcessMessage(NotificationMessage.CreateErrorMessage(ex.Message, ex));
                }
                //ExEnd:LoggerWithManualExceptionHandling
            }