zoukankan      html  css  js  c++  java
  • C# 插入excel 单元格数据、写入Excel数据

             /// <summary>
            /// 插入数据
            /// </summary>
            /// <param name="rowIndex">行号</param>
            /// <param name="columnIndex">列号</param>
            /// <param name="content">内容</param>
            /// <param name="comment">批注</param>
            public static void InsertCell(int rowIndex, int columnIndex, string content, string comment)
            {

                Microsoft.Office.Interop.Excel.ApplicationClass excel = wbb.Application as Microsoft.Office.Interop.Excel.ApplicationClass;

                Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbooks[1];

                int a = wb.Application.ActiveCell.Row;

                Microsoft.Office.Interop.Excel.Worksheet ws = wb.Worksheets[1] as Microsoft.Office.Interop.Excel.Worksheet;

                range = ws.Cells;

                Microsoft.Office.Interop.Excel.Range oCell = range[rowIndex, columnIndex] as Microsoft.Office.Interop.Excel.Range;         

                oCell.Value2 = content;
            }

  • 相关阅读:
    [NOIP2013] 提高组 洛谷P1979 华容道
    Vijos P1404 遭遇战
    CodeVS 1506 传话
    P1546 最短网络 Agri-Net
    HDU 4747 Mex
    POJ1020 Anniversary Cake
    【数据结构】平衡二叉树
    【数据结构】二叉排序树
    【数据结构】二叉树
    概念源于生活
  • 原文地址:https://www.cnblogs.com/ok519/p/1570957.html
Copyright © 2011-2022 走看看