/// <summary>
        /// Saves the Data Source Information
        /// </summary>
        /// <param name="wizardInfo"></param>
        private void SaveDataSourceInfo()
        {
            if (m_wizardInfo.DataSourceParser == null)
            {
                return;
            }

            m_dataSourceType = m_wizardInfo.DataSourceType;

            switch (m_wizardInfo.DataSourceType)
            {
            case DataSourceType.Excel:
                ExcelStorageInfo sourceInfo = m_wizardInfo.DataSourceParser.StorageInfo as ExcelStorageInfo;
                ExcelStorageInfo dataInfo   = new ExcelStorageInfo(sourceInfo.Source);
                dataInfo.WorkSheetName           = sourceInfo.WorkSheetName;
                dataInfo.RowContainingFieldNames = sourceInfo.RowContainingFieldNames;

                m_dataStorageInfo = dataInfo;
                break;

            case DataSourceType.MHT:
                m_dataStorageInfo = new MHTStorageInfo(m_wizardInfo.DataSourceParser.StorageInfo.Source);
                var fields = new List <SourceField>();
                foreach (SourceField field in m_wizardInfo.DataSourceParser.StorageInfo.FieldNames)
                {
                    fields.Add(field);
                }
                m_dataStorageInfo.FieldNames = fields;
                m_mhtSource = m_wizardInfo.MHTSource;
                break;

            default:
                throw new InvalidEnumArgumentException("Invalid Enum Value");
            }
        }
Example #2
0
 /// <summary>
 /// Initializes the Storage Information
 /// </summary>
 /// <param name="info"></param>
 private void InitializeStorage(MHTStorageInfo info)
 {
     try
     {
         string newMHTFilePath = Path.GetTempFileName() + ".mht";
         File.Copy(Path.GetFullPath(info.Source), newMHTFilePath);
         m_document = Application.Documents.Open(newMHTFilePath);
         m_isCopied = true;
     }
     catch (COMException)
     {
         throw new FileFormatException();
     }
     Application.Visible = false;
     StorageInfo         = info;
 }