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


C# Worksheet.Select方法代码示例

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


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

示例1: GetVisibleFormExcel

        static void GetVisibleFormExcel()
        {
            //Console.WriteLine("please choose Excel File");
            //OpenFileDialog ofD = new OpenFileDialog(); ofD.ShowDialog();
            //string fName = ofD.FileName;

            //Excel.Application xApp = new Excel.Application();
            //xApp.Visible = true;
            //Excel.Workbook xbook = xApp.Workbooks.Open("C:\\share\\temp.xlsx");
            xSheet = xbook.Sheets[2];
            xSheet.Select();

            Excel.Range xRange = null;
            string appKeyStr = null; string visibleStr = null;
            int i = 2;
            xRange = xSheet.Cells[i, 1]; appKeyStr = xRange.Value2;
            while (!String.IsNullOrEmpty(appKeyStr))
            {
                appKeyArr.Add(appKeyStr.ToString().Trim());
                xRange = xSheet.Cells[i, 3]; visibleStr = xRange.Value2.ToString().Trim(); VisibleArr.Add(visibleStr);

                //Console.WriteLine("Name:{0} IE:{1} FireFox:{2} Chrome:{3}", appName,ie,firefox,chrome);
                i++;
                xRange = xSheet.Cells[i, 1]; appKeyStr = xRange.Value2;
            }

            //Console.WriteLine("Done");
            xSheet = null;
            //xbook = null; xApp.Quit(); xApp = null;
        }
开发者ID:LeonZhang77,项目名称:Tools,代码行数:30,代码来源:Program.cs

示例2: ExcelOperator

        //for writing
        public ExcelOperator()
        {
            ExcelApp = new Excel.Application();
              workbooks = ExcelApp.Workbooks;
              workbook = workbooks.Add();
              sheets = workbook.Sheets;
              worksheet = sheets[1];
              worksheet.Select(Type.Missing);

              directoryPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
              fileName = "shift.xlsx";
        }
开发者ID:pumpkinheader,项目名称:reverseShift,代码行数:13,代码来源:ExcelOperator.cs

示例3: CreateNewPage

        /// <summary>
        /// Creates a new page with a given name (if Excel)
        /// </summary>
        /// <param name="worksheetName"></param>
        public override void CreateNewPage(string worksheetName)
        {
            // post format the previous document
            this.CreateDocumentSpecificPostFormatting();

            // worksheet information
            worksheet = (Excel.Worksheet)workbook.Worksheets.Add(Type.Missing, worksheet);
            worksheet.Select();
            worksheet.Name = worksheetName;

            // excel positioning vars
            this.starterRow = 1;
            this.currentRow = 2;
            this.currentColumnCount = 4;
            this.currentColumnOffset = 2;

            // rem grid lines
            app.ActiveWindow.DisplayGridlines = false;
        }
开发者ID:acas,项目名称:tfs-release-notes,代码行数:23,代码来源:ExcelGenerator.cs

示例4: UpdateToMasterList

        static void UpdateToMasterList()
        {
            //Console.WriteLine("please choose Excel File");
            //OpenFileDialog ofD = new OpenFileDialog(); ofD.ShowDialog();
            //string fName = ofD.FileName;

            //Excel.Application xApp = new Excel.Application();
            //xApp.Visible = true;
            //Excel.Workbook xbook = xApp.Workbooks.Open("C:\\share\\temp.xlsx");
            xSheet = xbook.Sheets[1];
            xSheet.Select();

            Excel.Range xRange = null;
            string appNameStr = null; string visibleStr = null; string appKeyStr = null;
            int i = 2;
            xRange = xSheet.Cells[i, 1]; appNameStr = xRange.Value2;
            while (!String.IsNullOrEmpty(appNameStr))
            {

                xRange = xSheet.Cells[i, 6]; appKeyStr = xRange.Value2;

                if (!String.IsNullOrEmpty(appKeyStr))
                {
                    visibleStr = GetVisibleByAppKeyStr(appKeyStr.ToString().Trim());
                    xRange = xSheet.Cells[i, 7]; xRange.Value2 = visibleStr.ToString();
                }

                i++;
                xRange = xSheet.Cells[i, 1]; appNameStr = xRange.Value2;
            }

            //Console.WriteLine("Done");
            xSheet = null;
            //    xSheet = null; xbook = null; xApp.Quit(); xApp = null;
        }
开发者ID:LeonZhang77,项目名称:Tools,代码行数:35,代码来源:Program.cs


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