当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Office.Interop.Excel.Activate方法代码示例

本文整理汇总了C#中Microsoft.Office.Interop.Excel.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Excel.Activate方法的具体用法?C# Microsoft.Office.Interop.Excel.Activate怎么用?C# Microsoft.Office.Interop.Excel.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Interop.Excel的用法示例。


在下文中一共展示了Microsoft.Office.Interop.Excel.Activate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendToWorksheet

        public void SendToWorksheet(Excel.Workbook targetBook, Excel.Worksheet targetSheet)
        {
            Globals.Program.Application.ScreenUpdating = false;
            targetSheet.Activate();
            // reel entries A5~E5, pay at M5
            String col = "A";
            int row = 5;
            int stopCount = 0;
            String cell = col + row.ToString();
            String payCell = "N" + row.ToString();
            int stopSet = m_freeLinePays[0].StopValues.Count - 1;
            bool trim = true;
            String val = "";
            foreach (PaylineDescription line in m_freeLinePays)
            {
                if (line.Win <= 0)
                    continue;
                if (line.IsFreegameSet || line.IsModifierSet || line.HasWild)
                    //continue;
                    if (line.IsFreegameSet || line.IsModifierSet)
                        trim = true;

                col = "A";
                stopCount = 0;
                foreach (String stop in line.StopValues[stopSet].Values)
                {
                    cell = col + row.ToString();
                    if (stopCount == 5)
                        break;
                    stopCount++;
                    if (trim)
                        val = line.StopValues[stopSet].TrimValue(stop);
                    else
                        val = stop;
                    outputCell(targetSheet, cell, val);

                    col = incrementColumn(col);
                }
                payCell = "N" + row.ToString();
                outputCell(targetSheet, payCell, line.Win.ToString());
                row++;
            }
            row = 5;
            foreach (PaylineDescription line in m_freeLinePays)
            {
                if (line.Win <= 0)
                    continue;
                if (line.IsFreegameSet || line.IsModifierSet || line.HasWild)
                    //continue;
                    if (line.IsFreegameSet || line.IsModifierSet)
                        trim = true;

                col = "H";
                stopCount = 0;
                foreach (String stop in line.StopValues[stopSet].Values)
                {
                    cell = col + row.ToString();
                    if (stopCount == 5)
                        break;
                    stopCount++;
                    if (trim)
                        val = line.StopValues[stopSet].TrimValue(stop);
                    else
                        val = stop;
                    outputCell(targetSheet, cell, val);

                    col = incrementColumn(col);
                }
                row++;
            }
            m_rowCount = row;

            Globals.Program.Application.ScreenUpdating = true;

            updatePayLinks(targetBook);
        }
开发者ID:RichardRanft,项目名称:Importer,代码行数:76,代码来源:BallyFreeLinePayData.cs

示例2: FreezePanes

 private void FreezePanes(Excel.Worksheet worksheet)
 {
     worksheet.Activate();
     worksheet.Application.ActiveWindow.SplitColumn = 3;
     worksheet.Application.ActiveWindow.FreezePanes = true;
 }
开发者ID:TonyWu,项目名称:QvSubscriber,代码行数:6,代码来源:FunnelMonthlyMerge.cs

示例3: GetSheetInformation

        /// <summary>
        /// Excelシート各種情報取得
        /// </summary>
        private SheetInfo GetSheetInformation(Excel.Worksheet oSheet)
        {
            SheetInfo       info            = null;
            Excel.Range     oCells          = null;
            Excel.Worksheet oActiveSheet    = null;
            Excel.Window    oActiveWindow   = null;

            Debug.Assert(oSheet != null);
            try
            {
                if (oSheet == null)
                {
                    return null;
                }

                // シートをアクティベートする
                oActiveSheet    = (Excel.Worksheet)this._app.ActiveSheet;
                oSheet.Activate();
                oActiveWindow   = this._app.ActiveWindow;
                oCells          = oActiveWindow.ActiveCell;

                // シート情報取得および格納
                info = new SheetInfo();
                {
                    info.Name           = oSheet.Name;
                    info.Zoom           = (double)oActiveWindow.Zoom;
                    info.Gridlines      = oActiveWindow.DisplayGridlines;
                    info.View           = oActiveWindow.View;
                    info.CellPosition = new Point((int)oCells.Column, (int)oCells.Row);
                }
            }
            finally
            {
                if (oActiveSheet != null)
                {
                    oActiveSheet.Activate();
                    Marshal.ReleaseComObject(oActiveSheet);
                }
                oActiveSheet = null;

                if (oActiveWindow != null)
                {
                    Marshal.ReleaseComObject(oActiveWindow);
                }
                oActiveWindow = null;

                if (oCells != null)
                {
                    Marshal.ReleaseComObject(oCells);
                }
                oCells = null;
            }
            return info;
        }
开发者ID:narareimei,项目名称:StiffChecker,代码行数:57,代码来源:Stiffer.cs

示例4: FreezePanes

 public static void FreezePanes(Excel.Worksheet worksheet, int splitColumn, int splitRow)
 {
     worksheet.Activate();
     worksheet.Application.ActiveWindow.SplitColumn = splitColumn;
     worksheet.Application.ActiveWindow.SplitRow = splitRow;
     worksheet.Application.ActiveWindow.FreezePanes = true;
 }
开发者ID:TonyWu,项目名称:QvSubscriber,代码行数:7,代码来源:ExcelUtilies.cs

示例5: checkValue

 private bool checkValue(Excel.Workbook book, Excel.Worksheet sheet, String cell)
 {
     book.Activate();
     if (book.ActiveSheet != sheet)
         sheet.Select();
     Excel.Range test = sheet.get_Range(cell);
     try
     {
         sheet.Select(test);
     }
     catch (Exception e)
     {
         // apparently, an empty cell is not valid for selection.
         return true;
     }
     try
     {
         if (test.Value2 == "" || test.Value2 == null)
             return false;
         else
             return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
开发者ID:RichardRanft,项目名称:Importer,代码行数:27,代码来源:CalcImport.cs


注:本文中的Microsoft.Office.Interop.Excel.Activate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。