vb.net 只读模式预览Excel文件

只读模式打开"c:\a.xlsx"目录下的文件。

Dim ex AS New Microsoft.Office.Interop.Excel.Application

Dim wb AS Microsoft.Office.Interop.Excel.WorkBook = ex.WorkBooks.Open("c:\a.xlsx",  , True)

Dim sh AS Microsoft.Office.Interop.Excel.Worksheet = wb.ActiveSheet

sh.EnableSelection = Microsoft.Office.Interop.Excel.XLEnableSelection.xlNoRestrictions

sh.Protect(, True, True, True)

ex.Visible = True

猜你喜欢

转载自blog.csdn.net/piaoxueergogo/article/details/48319229