コード例 #1
0
        void SelectionConvert_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            try
            {
                WordSelectionDocument doc = new WordSelectionDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);
#if !QueryAllFonts
                // first get the fonts the user wants to process
                OfficeDocumentProcessor aSelectionProcessor = null;
                FontConvertersPicker    aFCsPicker          = new FontConvertersPicker(doc);
                if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
                {
                    FontConverters aFCs = aFCsPicker.SelectedFontConverters;
                    aSelectionProcessor = new OfficeDocumentProcessor(aFCs, new SILConverterProcessorForm());
                }
#else
                OfficeDocumentProcessor aSelectionProcessor = new OfficeDocumentProcessor((FontConverters)null, new SILConverterProcessorForm());
#endif
                if (aSelectionProcessor != null)
                {
                    doc.ProcessWordByWord(aSelectionProcessor);
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
        }
コード例 #2
0
        void SelectionConvert_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            try
            {
                WordSelectionDocument   doc = new WordSelectionDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);
                OfficeDocumentProcessor aSelectionProcessor = new OfficeDocumentProcessor((FontConverters)null, new SILConverterProcessorForm());
                doc.ProcessWordByWord(aSelectionProcessor);
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
        }