日期:2014-05-18  浏览次数:20937 次

C#生产EXCEL文件如何锁定单元格???
我用程序生产了Excel文件~但是生产出的Excel中的一些地方我不想让他人修改~想给其锁定~我在程序中如何生产Excel文件并想锁定要锁定的单元格呢????

------解决方案--------------------
楼主,你用宏的方式肯定是可行的.在C#里如此执行宏:
objExcel.Run("Macro1", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

这里的objExcel是你实例化的:Excel.Application