Exemplo n.º 1
0
        private void but_WooTable_xls2_Click(object sender, RibbonControlEventArgs e)
        {
            Microsoft.Office.Interop.Excel.Worksheet _sht = null;
            if (tog_WooTable_XLS.Checked)
            {
                try
                {
                    Microsoft.Office.Interop.Excel.Application _app = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
                    _sht = _app.ActiveSheet;
                }
                catch (Exception E)
                {
                    _sht = null;
                    System.Windows.Forms.MessageBox.Show("Could not touch the opened MS Excel document: " + E.Message + ". Will paste to a new document, instead.", "WooTable .::. Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }

            Globals.ThisAddIn.Application.ScreenUpdating = false;
            try
            {
                Word.Range _oldSel = Globals.ThisAddIn.Application.Selection.Range;
                Globals.ThisAddIn.Application.Selection.Tables[1].Select();
                Word.Table _tab = Globals.ThisAddIn.Application.Selection.Tables[1];
                //Word.Table _tab = Globals.ThisAddIn.Application.ActiveDocument.Tables[Globals.ThisAddIn.Application.ActiveDocument.Range(0, Globals.ThisAddIn.Application.Selection.Tables[1].Range.End).Tables.Count];
                ConverterE.TableToExcel(_tab.Range, "table", _sht);
                _oldSel.Select();
            }
            finally
            {
                Globals.ThisAddIn.Application.ScreenUpdating = true;
            }
        }
Exemplo n.º 2
0
 private void but_WooTable_xls1_Click(object sender, RibbonControlEventArgs e)
 {
     Microsoft.Office.Interop.Excel.Worksheet _sht = null;
     if (tog_WooTable_XLS.Checked)
     {
         try
         {
             Microsoft.Office.Interop.Excel.Application _app = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
             _sht = _app.ActiveSheet;
         }
         catch (Exception E)
         {
             _sht = null;
             System.Windows.Forms.MessageBox.Show("Could not touch the opened MS Excel document: " + E.Message + ". Will paste to a new document, instead.", "WooTable .::. Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
         }
     }
     ConverterE.TableToExcel(Globals.ThisAddIn.Application.Selection.Range, "range", _sht);
 }
Exemplo n.º 3
0
 private void sbut_WooTable_XLS1_Click(object sender, RibbonControlEventArgs e)
 {
     ConverterE.AllTablesToExcel(Globals.ThisAddIn.Application.ActiveDocument, "alltables");
 }