将范围从excel数组复制到工作文档中

时间:2018-11-20 01:50:41

标签: arrays copy paste

我们非常感谢您提供的帮助,包括指向资源的链接。 我试图将42页的A1:H238范围复制到已经存在的Word文档中。并将每个范围放入与该范围相对应的书签中。

范围由包含42个下拉框的表确定,然后引用到包含页面名称的数据库,该页面名称返回所需的范围。

我有以下代码,并且无法获取正确的语法来引用和复制数组内的rhe范围。

Option Base 1'强制数组从1而不是0开始

List<Partido_E> lista = new List<Partido_E>();

try
{       
    conexion = bd.LeerDeBaseDeDatos();       
    orden = new OracleCommand(
        @"select * from partido 
          where TO_CHAR(fecha, 'DD/MM/YYYY') = :anyo AND 
                equipo_l = :equipol AND 
                equipo_v = :equipov ", conexion);

    orden.Parameters.Add(new OracleParameter("anyo", fecha));
    orden.Parameters.Add(new OracleParameter("equipol", equipoL));
    orden.Parameters.Add(new OracleParameter("equipov", equipoV));
    orden.BindByName = true;

    lector = orden.ExecuteReader();

    while(lector.Read())
    {
        lista.Add(new Partido_E(lector.GetString(0),
                                lector.GetString(1), 
                                lector.GetDateTime(2),
                                lector.GetString(3),
                                lector.GetString(4),
                                lector.IsDBNull(5) ? 0 : lector.GetInt32(5),
                                lector.IsDBNull(6) ? 0 : lector.GetInt32(6),
                                lector.IsDBNull(7) ? 0 : lector.GetInt32(7)
                 ));
    }


    lector.Close();
    lector.Dispose();
    orden.Dispose();

    bd.CerrarConexion();
}
catch (Exception e)
{
    Console.WriteLine("Error " + e.ToString());
    Console.ReadLine();
}

return lista;

0 个答案:

没有答案