在C#中更改Excel单元格格式 [英] Changing Excel cell format in C#
问题描述
如何使用C#中的Microsoft Excel 12.0库在Excel中更改单元格的格式?更具体地说,我想将给定的单元格更改为文本格式.
How can I change the format of a cell in Excel using the Microsoft Excel 12.0 Library in C#? More specifically, I want to change a given cell to text format.
我已阅读 .net c#更改excel单元格格式,但是单元格仍显示一般"(尽管确实显示为文本).
I have read .net c# changing excel cell format, but the cell still says general (although it does display as text).
推荐答案
这取决于您实际尝试实现的格式.更改为所需的格式没有灵丹妙药.如果您需要格式化数字,则可以使用此之类的方法.我对
It depends on the format you're actually trying to implement. There's not a silver bullet for changing to any format you want. If it's formatting numbers that you need, you could use something like this. I ran into a lot of suggestions to create a macro, you can do some pretty specific tasks that you define yourself.
这篇关于在C#中更改Excel单元格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!