private void SelectWordFile()
        {
            OpenItem();
            if (_currentItem == null)
            {
                MessageBox.Show("Paste item id to the \"Item id\" textbox first");
                return;
            }

            Nullable <bool> result;

            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = "Word files (*.docx)|*.docx|Word files (*.doc)|*.doc";
            result = openFileDialog.ShowDialog();
            if (result == true)
            {
                FileNameText = openFileDialog.FileName;
                SystemWeaver.WordImport.Common.ReadWord rw;
                using (var wrapper = new ThreadedWindowWrapper())
                {
                    wrapper.LaunchThreadedWindow <WindowLoadingProgress>(true);
                    wrapper.SetTitle("Loading word document");
                    wrapper.SetStatus("Loading word document, don't use clipboard now");

                    bool failedWithLoadDLL;
                    rw = new SystemWeaver.WordImport.Common.ReadWord(FileNameText, _currentItem, wrapper, out failedWithLoadDLL);
                    if (failedWithLoadDLL)
                    {
                        FileNameText = "";
                        return;
                    }
                }

                Paragraphs        = rw.Paragraphs;
                DescriptionStyles = new ObservableCollection <SwStyle>();
                var stylesUsed = rw.StylesInUse;
                if ((from s in stylesUsed where s.Level == 10 select s).Count() > 0)
                {
                    var temp = (from s in stylesUsed where s.Level == 10 select s).ToList();
                    DescriptionStyles = new ObservableCollection <SwStyle>(temp);
                    stylesUsed        = (from s in stylesUsed where s.Level != 10 select s).ToList();
                }
                SwStyles        = new ObservableCollection <SwStyle>(stylesUsed);
                InformationText = "Word document loaded!";
            }
        }
        private void ImportWordDocument()
        {
            if (CurrentItem == null)
            {
                return;
            }

            if (CurrentItem.GetAllParts().Count > 0)
            {
                throw new Exception("Item not empty");
            }

            ErrorText = "";

            if (Paragraphs == null || Paragraphs.Count == 0)
            {
                ErrorText = "No word-file selected!";
                return;
            }

            try
            {
                InformationText = "Word import started!";
                ValidateParagraphs(Paragraphs, DescriptionStyles.ToList());

                using (var wrapper = new ThreadedWindowWrapper())
                {
                    wrapper.LaunchThreadedWindow <WindowLoadingProgress>(true);
                    wrapper.SetTitle("Importing word document");

                    Import imp = new Import(_currentItem, Paragraphs, SwStyles.ToList(), DescriptionStyles.ToList(), SWConnection.Instance.Broker.ServerId, wrapper);
                }
                InformationText = "Word import completed!";
            }
            catch (Exception)
            {
                throw;
            }
        }