Tag: luacom

我如何读取luacom的xlsx文件?

我有以下代码 excel = luacom.CreateObject("Excel.Application") pcall(excel.Open, excel, "1.xlsx") if excel ~= nil then sheets = excel.Worksheets sheet1 = sheets:Item(1) for row=1, 30 do for col=1, 30 do local cellValue = sheet1.Cells(row, col).Value2 if cellValue ~= nil then –print(cellValue) end end end end 我怎样才能修改它,以便能够读取excel文件,导致目前excelvariables没有任何workhett,似乎像加载没有顺利。

使用Luacom在Excel中更改单元格边框

我在Excel中有一个单元格的范围,我需要确保显示所有边框。 到目前为止,我有: oExcel = luacom.GetObject("Excel.Application"); Book = oExcel.Workbooks:Open(_DesktopFolder .. "\\document.xlsx"); Sheet = Book.WorkSheets(1); RangeRef = "A3:E56" local BorderList = Sheet:Range(RangeRef) BorderList:Select(); 我知道下一部分是这样的: BorderList.Borders(xlEdgeLeft).LineStyle(xlContinuous) 但我似乎无法得到它的工作。 我收到一个错误,说“错误:”这真的很有帮助:P 任何人都有这方面的信息? 谢谢