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


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

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


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

示例1: GetSheet

 //获取一个工作表
 /// <summary>
 /// 获得sheet
 /// </summary>
 /// <param name="sheets">sheet</param>
 /// <param name="sc">序号</param>
 public Excel._Worksheet GetSheet(Excel.Sheets sheets, int sc)
 {
     Excel._Worksheet worksheet = (Microsoft.Office.Interop.Excel._Worksheet)sheets.get_Item(sc);
     return worksheet;
 }
开发者ID:kzmmkou,项目名称:ProgramRoadCenter,代码行数:11,代码来源:ExcelBase.cs

示例2: CheckAllProfiles

        static private bool CheckAllProfiles(Hashtable oldBook, Excel.Sheets newSheets)
        {
            try
            {
                Hashtable oldRows = new Hashtable();
                Hashtable newRows = new Hashtable();
                Excel.Worksheet saveSheet = null;


                #region Läs in alla nya, och hitta sheetet "AllProfiles"
                //Läs in alla nya
                int numOfNewSheets = _newLog.Worksheets.Count;
                //// get the first worksheet from the collection of worksheets
                Excel.Worksheet newWorksheet = null;// (Excel.Worksheet)newSheets.get_Item(1);
                //// loop through 10 rows of the spreadsheet and place each row in the list view

                //_compareProgress.StartTotal("Loading new AllProfiles Log sheets and compares...", numOfNewSheets);//-1 );
                //int sheetsDone = 0;//För progress

                //Compare to old rows
                for (int sheetNr = 1; sheetNr <= numOfNewSheets; sheetNr++)
                {
                    //if (MainForm.StopGracefully)
                    //    break;

                    string name = ((Excel.Worksheet)newSheets.get_Item(sheetNr)).Name;

                    newWorksheet = (Excel.Worksheet)newSheets.get_Item(sheetNr);

                    //Läs in hela nuv. nya arket till en HT
                    if (name.StartsWith("AllProfiles"))//Specialfall för AllProfiles-flikar
                        getExcelRows(newWorksheet, newRows);

                    if (name == "AllProfiles")
                        saveSheet = newWorksheet;

                    //Ev. Rensa _part1...X

                    //_compareProgress.SetTotal(sheetsDone++);
                }

                #endregion

                #region Lägg ihop alla gamla
                oldRows = oldBook["AllProfiles"] as Hashtable;

                foreach (DictionaryEntry item in oldBook)
                {
                    string name = item.Key as string;
                    Hashtable rows = item.Value as Hashtable;

                    //if (name == "AllProfiles")//Specialfall för AllProfiles-flikar
                    //{
                    //    oldRows = rows;
                    //}
                    if (name.StartsWith("AllProfiles_"))//Specialfall för AllProfiles-flikar
                    {
                        foreach (DictionaryEntry innerItem in rows)
                        {
                            if (oldRows.ContainsKey(innerItem.Key as string))
                            {
                                //Här finns en dublett! Det ska ladrig inträffa, för det ska vara unika som läggs till, även om det iofs är olika blad
                                Console.WriteLine("Double fond in CheckAllProfiles old rows: " + name + ". Key: >" + innerItem.Key as string + "<");
                            }
                            else
                                oldRows.Add(innerItem.Key as string, innerItem.Value as ExcelRowEntry);
                        }
                    }
                }
                #endregion

                compareExcelRows(saveSheet, oldRows, newRows);
            }
            catch (Exception allPexcp)
            {
                throw new Exception("Error in comparing AllProfiles log with new log. Was the log opened in Excel during compare processing?\r\n\r\n(Sys err: " + allPexcp.Message + ").", allPexcp);
            }

            return true;
        }
开发者ID:perragradeen,项目名称:webbankbudgeter,代码行数:80,代码来源:ExcelLogRowComparer.cs


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