我已经使用epplus库创建了一个excel电子表格。
在此电子表格中,带有下拉列表的列很少。
我需要使这些下拉列表可搜索。我们可以将下拉列表应用于单个单元格,并使用excel函数进行搜索。
但不可能将相同的方法应用于列中的所有单元格。
但这是可以使用excel插件来实现的,比如'excel校园-列表-搜索-插件‘(https://members.excelcampus.com/products/the-list-search-add-in/categories/142180/posts/422610)。
我不希望每个用户在使用从我的应用程序创建的电子表格时都安装excel插件。
当我使用epplus库从我的.NET应用程序创建电子表格时,我希望自动添加插件。
发布于 2019-05-17 11:48:18
你的问题有点令人困惑!也许这对你有帮助:
//Create the data set and table
DataSet ds = new DataSet("New_DataSet");
DataTable dt = new DataTable("New_DataTable");
//Set the locale for each
ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
dt.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
//Open a DB connection (in this example with OleDB)
OleDbConnection con = new OleDbConnection(dbConnectionString);
con.Open();
//Create a query and fill the data table with the data from the DB
string sql = "SELECT Whatever FROM MyDBTable;";
OleDbCommand cmd = new OleDbCommand(sql, con);
OleDbDataAdapter adptr = new OleDbDataAdapter();
adptr.SelectCommand = cmd;
adptr.Fill(dt);
con.Close();
//Add the table to the data set
ds.Tables.Add(dt);
//Here's the easy part. Create the Excel worksheet from the data set
ExcelLibrary.DataSetHelper.CreateWorkbook("MyExcelFile.xls", ds);
https://stackoverflow.com/questions/56179288
复制相似问题