如何使用 C# 在不打开 EXCEL 的情况下突出显示 XSL 文件中的行
我有一个 XSL 文件,是从 CSV 和对象等生成的。 除了我需要突出显示 xsl 文件中的特定行之外,一切都已完成。我不想打开 Excel 并使用宏。
有没有办法在 C# 中做到这一点?
I have an XSL file that I am generating from CSV from and Object etc. etc.
Everything is done except that I need to highlight particular rows in the xsl file. I don't want to have to open Excel and use Macros.
Is there a way to do this in C#?
您指的是 XLS 而不是 XSL 吗?
如果是这样,这里有一个链接,解释了如何使用 Excel 作为对象的基础知识。由于您将其作为对象打开,因此它将不可见(除非您希望它可见),但您将具有完全访问权限来导航、突出显示行以及执行您通常在 Excel 中执行的任何其他操作。完成后,处理该物体。
通过 C# 连接到 Excel 并进行导航
Do you mean XLS and not XSL?
If so, here's a link that explains the basics of how to use Excel as an object. Since you're opening it as an object, it won't be visible (unless you want it to be), but you'll have full access to navigate, highlight rows, and do whatever else you would normally do in Excel. When done, dispose the object.
Connecting to and navigating Excel through C#