Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 c# .net。我正在从头开始创建一个新的 excel 文件。一些单元格包含文本,一些单元格包含数字。如何使用 C# ExcelPackage 将单元格的类型设置为数字?
这应该有效:
// Get the entire column you want (in this example column A) var range = someWorkSheet.get_Range("A:A"); // Set the format to numbers range.NumberFormat = "0";
(如果您想将其设置为文本,那么range.NumberFormat = "@";)
range.NumberFormat = "@";