当前位置: 动力学知识库 > 问答 > 编程问答 >

excel - c# Export CSV File Hide Columns

问题描述:

I am using HttpContext to export a data table to a CSV file which will be used in excel for people to look at. This very same file will later be imported and parsed to get values inserted and such. However there are some columns that need to be hidden in the final excel export but still need to be recognized when importing the file. So essentially when looking at the file through excel, people should not see the hidden columns, but they should be there and readable when parsing the file back. Is there a property that I need to set to make this happen?

网友答案:

This is not possible with the .CSV file format. It does not support flagging columns as invisible and excel will not, by default, hide any columns when you open a .csv file with it.

You would need a custom excel template/plugin and custom logic to detect and hide certain columns.

My recomendation is that you do not go this way. Choose a different export / edit strategy. If excel is a must, switch to exporting full excel documents where you can then customize the columns and define how and when they can be edited.

分享给朋友:
您可能感兴趣的文章:
随机阅读: