function export_excel(help,helpColumns)
local line = CVector();
local lineName = CVector();
helpColumns:orderBy('序号');
for i=0,helpColumns:size()-1 do
if helpColumns:vs(i,'是否显示') == '1' then
line:push_back(helpColumns:vs(i,'编码'));
lineName:push_back(helpColumns:vs(i,'显示名称'));
end
end
local xlsx = CLuaXlsxUtil();
local helpFormat = CSelectHelp();
for i=0,lineName:size()-1 do
xlsx:writeString(1,i+1,lineName:get(i),helpFormat);
end
for i=0,help:size()-1 do
for j=0,line:size()-1 do
xlsx:writeString(i+2,j+1,help:vs(i,line:get(j)),helpFormat);
end
end
local sName = ui:getSaveFileName('保存文件',cutil:getBusiUniqueID('',''),'(*.xlsx)');
xlsx:saveAs(sName);
if ui:msgConfirm('是否打开文件', sName) then
sName = string.gsub(sName, '/', '\\');
os.execute(string.format([[explorer "%s"]], sName));
end
end
local m_pGrid = CLuaGridUtil();
m_pGrid:SetGrid(ui:getDialogName(),'id_grid');
local m_help = CSelectHelp();
m_pGrid:setHelp(m_help);
local helpColumns = CSelectHelp();
m_pGrid:getColumnsInfo(helpColumns);
local help = CSelectHelp();
m_pGrid:getHelp(help);
export_excel(help,helpColumns);