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;
            }

  • 相关阅读:
    ubuntu的php7与apache2的环境搭建
    git服务器搭建post-receive 钩子部署服务端代码
    node redis安装与使用
    微信小程序坑集
    微信小程序登录
    mobx react
    react-native-router-flux 下部导航
    java
    java
    java
  • 原文地址:https://www.cnblogs.com/ok519/p/1570957.html
Copyright © 2011-2022 走看看