使用c#协助读取Excel中的下拉列表 [英] Assistance with reading a drop down in excel using c#

查看:141
本文介绍了使用c#协助读取Excel中的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#编写一个程序,它读取并随机填充一个excel电子表格,其中包含各种类型的单元格,包括下拉列表(工作簿都是不同的,我不知道它们将把下拉放在哪里。我真的不在乎下拉列表中的数据
我只需要从列表中选择一个项目并填充单元格。我正在使用Microsoft.Office.Interop.Excel并且功能大部分都在工作,但我正在努力寻找下拉菜单,然后使用
默认值或下拉列表中的任何值进行填充。 我的代码如下。 (善待我仍然是c#的新手: - ))

I am writing a program in C# that reads and randomly populates an excel spreadsheet with various types of cells including drop-downs (the workbooks are all different and I never know where they are going to put the drop down. I don't really care what data is in the drop-down I just need to select an item from the list and populate the cell). I am using Microsoft.Office.Interop.Excel and have functionality working for the most part but am struggling on how to locate the drop downs and then populate with the default or any value in the drop-down list.  My code is as follows. (be kind I am still new to c# :-))

提前感谢您提供任何帮助。

Thank you in advance for any assistance you can provide.

推荐答案

您好Spitfyre586,

Hi Spitfyre586,

因为您的问题与excel更相关,我将把它移到VSTO论坛以获得合适的支持。

Since your question is more related to excel, I will move it to VSTO forum for suitable support.

https://social.msdn.microsoft.com/Forums/en-US/home?forum=vsto&filter=alltypes&sort=lastpostdesc

Visual C#论坛讨论并询问有关C#编程语言,IDE,库,示例和工具的问题。

The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

最好的问候,

Wendy


这篇关于使用c#协助读取Excel中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆