require("luacom");
require("lc");
--创建excel对象
local excel = luacom.CreateObject("Excel.Application"); --创建新的实例
excel.Visible = false;
local book =excel.Workbooks:Add();
--读第一个工作表
local sheet = book.Sheets(1);
sheet.Cells(1, 1).Value2 = "hello";
sheet.Cells(1, 2).Value2 = lc.a2u("你好");
sheet.Cells(2, 1).Value2 = "hello";
sheet.Cells(2, 2).Value2 = "java";
local name = 'E://' .. lc.a2u("fjhx") .. '.xls';
-- 保存
book:SaveAs(name);
book:Close();
--[[ 关闭excel -------------]]
excel:Quit();
--释放资源
excel = nil;
collectgarbage();