Beispiel #1
0
		void ConvertTableField_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
		{
			try
			{
				if (Application.Selection == null)
					throw new ApplicationException("First select the cells that you want to convert using a system converter");

				ExcelDocument doc = new ExcelDocument(Application.Selection);
				if (m_aSelectionProcessor == null)
				{
					string strTitle = "Choose the converter for the selected areas/cells";
					EncConverters aECs = GetEncConverters;
					if (aECs != null)
					{
						IEncConverter aIEC = aECs.AutoSelectWithTitle(ConvType.Unknown, strTitle);
						FontConverter aFC = new FontConverter(new DirectableEncConverter(aIEC));
						m_aSelectionProcessor = new OfficeDocumentProcessor(aFC, new SILConverterProcessorForm());
					}
				}

				if (m_aSelectionProcessor != null)
					if (doc.ProcessWordByWord(m_aSelectionProcessor))
						m_aSelectionProcessor = null;
			}
			catch (Exception ex)
			{
				DisplayException(ex);
			}
		}
Beispiel #2
0
        void ConvertTableField_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            try
            {
                if (Application.Selection == null)
                {
                    throw new ApplicationException("First select the cells that you want to convert using a system converter");
                }

                ExcelDocument doc = new ExcelDocument(Application.Selection);
                if (m_aSelectionProcessor == null)
                {
                    string        strTitle = "Choose the converter for the selected areas/cells";
                    EncConverters aECs     = GetEncConverters;
                    if (aECs != null)
                    {
                        IEncConverter aIEC = aECs.AutoSelectWithTitle(ConvType.Unknown, strTitle);
                        FontConverter aFC  = new FontConverter(new DirectableEncConverter(aIEC));
                        m_aSelectionProcessor = new OfficeDocumentProcessor(aFC, new SILConverterProcessorForm());
                    }
                }

                if (m_aSelectionProcessor != null)
                {
                    if (doc.ProcessWordByWord(m_aSelectionProcessor))
                    {
                        m_aSelectionProcessor = null;
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
        }