public static void UploadSelection()
 {
     // From a menu we don't need the QueueAsMacro, but from a ribbon button we do
     ExcelAsyncUtil.QueueAsMacro(() =>
     {
         var selection = XlCall.Excel(XlCall.xlfSelection) as ExcelReference;
         if (selection != null)
         {
             UploadManager.UploadSelection(selection);
         }
         else
         {
             Console.Beep(); // Like when it's some chart element
         }
     });
 }
Пример #2
0
        public static void UploadWorksheet()
        {
            // From a menu we don't need the QueueAsMacro, but from a ribbon button we do
            ExcelAsyncUtil.QueueAsMacro(() =>
            {
                var selection = XlCall.Excel(XlCall.xlfSelection) as ExcelReference;
                // Expand selection reference to include the whole sheet
                selection = new ExcelReference(0, ExcelDnaUtil.ExcelLimits.MaxRows,
                                               0, ExcelDnaUtil.ExcelLimits.MaxColumns,
                                               selection.SheetId);

                if (selection != null)
                {
                    UploadManager.UploadSelection(selection);
                }
                else
                {
                    Console.Beep(); // Like when it's some chart element
                }
            });
        }