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


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

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


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

示例1: addFirstCol

 private Excel.Range addFirstCol(ref Excel.Range pRng, Excel.Range vCurCol) {
   int vCurColN = vCurCol.Column;
   int vCurRowN = vCurCol.Row;
   int vCurRowsN = vCurCol.Rows.Count;
   vCurCol.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, true);
   Excel.Range vNewCol = ExcelSrv.getRange(vCurCol.Worksheet, vCurCol.Worksheet.Cells[vCurRowN, vCurColN],
                                                      vCurCol.Worksheet.Cells[vCurRowN + vCurRowsN, vCurColN]);
   vCurCol.Copy(vNewCol);
   vCurCol.ColumnWidth = vNewCol.ColumnWidth;
   return vCurCol;
 }
开发者ID:tormoz70,项目名称:Bio.Framework.8,代码行数:11,代码来源:tmio_DS2XL.cs

示例2: TeamWorkbook

    }  // end TeamWorkbook()



    public void PasteScores( Excel.Range scores )
    {
      // note: for PasteSpecial to work, both the student and team workbooks must be opend using the same Excel App
      scores.Copy(); // copy scoares to clipboard
      string newCell = "A" + (++currentRow).ToString();  // Note: increment row
      Excel.Range excelRange = excelWorksheet.get_Range( newCell, newCell );  // starts with A7, then moves down

      try {
        excelRange.PasteSpecial( Microsoft.Office.Interop.Excel.XlPasteType.xlPasteAll,
                                 Microsoft.Office.Interop.Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone,
                                 false,
                                 true );  // transpose the column into a row
      }
      catch( Exception e )
      {
        Console.WriteLine( e.Message );
      }
    }  // end PasteScores()
开发者ID:cyboss77,项目名称:ClassAssessments,代码行数:22,代码来源:TeamWorkbook.cs

示例3: PasteScores

    }  // end PasteScores()


    public void PasteComments( Excel.Range comments )
    {
      comments.Copy();
      string newCell = "J" + ( currentRow ).ToString();   // very specific
      Excel.Range excelRange = excelWorksheet.get_Range( newCell, newCell );  

      try
      {
        excelRange.PasteSpecial( Microsoft.Office.Interop.Excel.XlPasteType.xlPasteAll,
                                 Microsoft.Office.Interop.Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone,
                                 false,
                                 false );  
      }
      catch ( Exception e )
      {
        Console.WriteLine( e.Message );
      }

    }  // end PasteComments()
开发者ID:cyboss77,项目名称:ClassAssessments,代码行数:22,代码来源:TeamWorkbook.cs

示例4: Paste_Filtered_Data

        public void Paste_Filtered_Data(Excel.Range Filtered_Data_Range)
        {
            Filtered_Data_Range.Copy();

            Excel.Worksheet PivotTable_WorkSheet = this.Application.ActiveWorkbook.Worksheets.Add();

            PivotTable_WorkSheet.Name = "Pivot Table";

            Excel.Range Paste_Range = PivotTable_WorkSheet.get_Range("A1");

            Paste_Range.PasteSpecial(Excel.XlPasteType.xlPasteAll, Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone, false, false);
        }
开发者ID:robojames,项目名称:JDTReport,代码行数:12,代码来源:Sheet2.cs

示例5: AddMDA4

        private void AddMDA4(excel.Workbook xlsWorkbook, excel.Worksheet xlsWorksheet, excel.Worksheet xlsSummary, excel.Range rng, List<AdminLevel> reportingUnits, Dictionary<int, DataRow> aggIntvs)
        {
            List<string> typeNames = new List<string> { "IntvAlb2" };
            List<string> typesToCalc = new List<string>();

            for (int i = Util.MaxRounds; i >= 1; i--)
            {
                if (!HasRoundNumber(reportingUnits, aggIntvs, typeNames,  typesToCalc, i))
                    continue;

                xlsWorksheet = (excel.Worksheet)xlsWorkbook.Sheets["MDA4"];
                if (i > 1)
                {
                    xlsWorksheet.Copy(System.Reflection.Missing.Value, xlsSummary);
                    xlsWorksheet = (excel.Worksheet)xlsWorkbook.Sheets[xlsSummary.Index + 1];
                    xlsWorksheet.Name = string.Format("MDA4_R{0}", i);
                }
                int rowCount = 9;
                foreach (var unit in reportingUnits)
                {
                    if (aggIntvs.ContainsKey(unit.Id))
                    {
                        AddValueToRange(xlsWorksheet, rng, "F" + rowCount, GetIntFromRow("PcIntvNumPsacTargeted", ref typesToCalc, aggIntvs[unit.Id], i, i, null, typeNames));
                        AddValueToRange(xlsWorksheet, rng, "G" + rowCount, GetIntFromRow("PcIntvNumSacTargeted", ref typesToCalc, aggIntvs[unit.Id], i, i, null, typeNames));
                        AddValueToRange(xlsWorksheet, rng, "H" + rowCount, GetIntFromRow("PcIntvNumAdultsTargeted", ref typesToCalc, aggIntvs[unit.Id], i, i, null, typeNames));
                        AddValueToRange(xlsWorksheet, rng, "J" + rowCount, GetIntFromRow("PcIntvPsacTreated", ref typesToCalc, aggIntvs[unit.Id], i, i, null, typeNames));
                        AddValueToRange(xlsWorksheet, rng, "K" + rowCount, GetIntFromRow("PcIntvNumSacTreated", ref typesToCalc, aggIntvs[unit.Id], i, i, null, typeNames));
                        AddValueToRange(xlsWorksheet, rng, "L" + rowCount, GetIntFromRow("PcIntvNumAdultsTreated", ref typesToCalc, aggIntvs[unit.Id], i, i, null, typeNames));

                        DateTime? startMda = GetDateFromRow("PcIntvStartDateOfMda", ref typesToCalc, aggIntvs[unit.Id], false, i, i, null, typeNames);
                        if (startMda.HasValue)
                            AddValueToRange(xlsWorksheet, rng, "E" + rowCount, startMda.Value.ToString("MM/dd/yyyy"));

                    }
                    rowCount++;
                }
            }
        }
开发者ID:ericjohnolson,项目名称:NadaNtd,代码行数:38,代码来源:PcJrfExporter.cs

示例6: refreshFormulaCols_sub

		private void refreshFormulaCols_sub(Excel.Range pSrcFormula, Excel.Range[] pRng){
			for(int i=0; i<pRng.Length; i++){
				Excel.Range vRng = pRng[i];
				pSrcFormula.Copy(vRng);
			}
		}
开发者ID:tormoz70,项目名称:Bio.Framework.8,代码行数:6,代码来源:CXLRootGroup.cs


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