public void openExcel(BackgroundWorker bgWorker = null) { if (bgWorker == null) { bgWorker = backgroundWorker; } bgWorker.ReportProgress(0, new BGReport("Initializing MS Excel ...")); excel = new Excel.App(Directory.GetCurrentDirectory() + @"\..\..\MethodA_Rules.xlsx"); }
public Translation(Excel.App excel, int row, string english) { _excel = excel; _row = row; keyEnglish = english; string[] subL = getCellStrings(LEXICON_COL); llLexicon = new List<string>(); foreach (string defns in subL) llLexicon.Add(defns.Replace("\n", "")); fillLL(MACEDONIAN_COL, ref llMacedonian); fillLL(SYNONYMS_COL, ref llSynonyms); }
public static void Main() { Excel.App app = new Excel.App(); app.InitializeComponent(); app.Run(); }
private void Worker_Startup(object sender, DoWorkEventArgs e) { _bgWorker.ReportProgress(0, String.Format(t("dictGeneration"), _xlsmSafeFileName)); bool hasDuplicates = false; int flags, i = 2; Excel.App excel = new Excel.App(_s.DictionaryPath); string fn = "dat/" + xlsmSafeFileNameNoExt + _s.RepeatsSuffix, key = excel.getString("A" + i), prevKey = ""; _odict.Clear(); while (!String.IsNullOrEmpty(key == null ? null : key.Trim())) { if (prevKey == key) { hasDuplicates = true; break; } prevKey = key; _odict[key] = new Translation(excel, i, key); key = excel.getString("A" + ++i); } excel.Close(); if (hasDuplicates || _odict.Count < 5) { _bgWorker.ReportProgress(100); MessageBox.Show(String.Format(t("msgErrorOdict"), _xlsmSafeFileName)); if (hasDuplicates) MessageBox.Show(String.Format(t("msgDuplicateFound"), key)); _s.DictionaryPath = ""; _s.Save(); Environment.Exit(0); } _bgWorker.ReportProgress(60, String.Format(t("loadingRepetitions"), fn)); if (File.Exists(fn)) using (FileStream fs = new FileStream(fn, FileMode.Open)) _dictRepeats = binFormatter.Deserialize(fs) as Dictionary<string, byte>; //foreach (var kvp in _dictRepeats) Console.WriteLine("{0}, {1}", kvp.Key, kvp.Value); fn = "dat/" + xlsmSafeFileNameNoExt + _s.WrongsSuffix; _bgWorker.ReportProgress(70, String.Format(t("loadingWrongs"), fn)); if (File.Exists(fn)) using (FileStream fs = new FileStream(fn, FileMode.Open)) _odictWrongs = binFormatter.Deserialize(fs) as OrderedDictionary; fn = "dat/" + xlsmSafeFileNameNoExt + _s.RecordsSuffix; _bgWorker.ReportProgress(80, String.Format(t("deserializeRecords"), fn)); _wRecords.deserializeOC(fn); _bgWorker.ReportProgress(90, t("checkConnection")); _isInternetOk = WinAPI.InternetGetConnectedState(out flags, 0); if (_isInternetOk) _isInternetOk = WinAPI.InternetCheckConnection("http://www.google.com/", 1, 0); }
private void showInExcel(int oDictIdx) { int row = oDictIdx + 2; Excel.App excel = new Excel.App(_s.DictionaryPath, true); excel.selectRange("A" + row + ":D" + row); WinAPI.ShowWindow(excel.MainWindowHandle, WinAPI.SW_SHOWMAXIMIZED); }
public void openExcel(BackgroundWorker bgWorker = null) { if (bgWorker == null) bgWorker = backgroundWorker; bgWorker.ReportProgress(0, new BGReport("Initializing MS Excel ...")); excel = new Excel.App(Directory.GetCurrentDirectory() + @"\..\..\MethodA_Rules.xlsx"); }