使用c sharp中的openxml创建Excel文件 [英] creating an Excel file using openxml in c sharp

查看:209
本文介绍了使用c sharp中的openxml创建Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用openxml创建一个excel文件,这个代码每15分钟就会在任务调度程序上运行以创建excel文件。我不能使用互操作,因为它不能使用任务调度程序,所以我使用了开放的xml。这个excel文件应该是readonly。我无法将此文件设为只读。我试着保护工作簿和工作表。可能是我错了。有人可以帮助我,如何准备excel以便用户不能编辑任何东西?



提前谢谢。

Hi,
I've a c sharp code where im creating a excel file using openxml and this code runs on a task scheduler every 15 mins to create the excel file. I cant use interop since it wont work with the task scheduler so i have used open xml. This excel file should be in readonly. im NOT able to make this file as read only. i tried protection for workbook and sheets. may be i used it wrong. Can somebody help me, how to make the excel readyonly so that the users cant edit anything?

Thanks in advance.

推荐答案

使用 ReadOnly 属性。 setattributes.aspx> File.SetAttributes方法 [ ^ ]。
Set ReadOnly attribute using File.SetAttributes Method[^].


这篇关于使用c sharp中的openxml创建Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆