简体   繁体   English

使用c#将所有Excel单元格类型更改为文本/常规

[英]Change all the Excel cells Type to Text/General using c#

I need to upload one excel file containing multiple value types and values with $ symbol etc. My requirement is to convert all the excel cell type to Text/General after uploading the excel file. 我需要使用$符号等上传一个包含多个值类型和值的excel文件。我的要求是在上传excel文件后将所有excel单元格类型转换为Text / General。 Thanks in Advance, Wilson. 在此先感谢,威尔逊。

Worksheet ws;

Range oRng;

Load your Workseet in the ws Now Select the Range of cells for which the formatting is to be done. 在ws中加载Workseet现在选择要进行格式化的单元格范围。

for eg 例如

oRng = ws.get_Range(StartCol + StartRow, EndCol + EndRow);

Now just set oRng.NumberFormat `= "@";`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM