简体   繁体   English

使用互操作[c#]打印Excel单元格的范围

[英]Printing Range of Excel cells using interop [c#]

I'm trying to print range of excel file, however when I write this lines Range("A:1","D10") is underlined with statement that "Non-invocable member of _Worksheet.Range[object, oject] cannot be used like a method". 我正在尝试打印excel文件的范围,但是当我写此行时, Range("A:1","D10")的下划线带有以下语句:“ _ Worksheet.Range [object,oject]的不可调用成员不能像方法一样使用”。

How do i change this and make it work? 我该如何更改并使其起作用?

(I'm using COM Microsoft.Office.Interop.Excel) (我正在使用COM Microsoft.Office.Interop.Excel)

xlWorkSheet.Range("A1:D10").PrintOutEx(misValue, misValue, misValue, misValue,
        misValue, misValue, misValue, misValue);

You use the wrong brackets ( is for VB 您使用了错误的括号 用于VB

xlWorkSheet.Range["A1:D10"].PrintOutEx(misValue, misValue, misValue, misValue,
        misValue, misValue, misValue, misValue);

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

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