--变量obj 代表excel对象
--变量table代表 查询的数据集,table:vs返回字符数据,table:vi返回事型数据,table:vd返回浮点数据
report_name="测试报表名称"
template_file="template/源代码组织图.xls"
dest_file="output/fffout.xls"
open_file = 1

function init()
	--tool = Util:new()

	--obj:SetDB("db","db","dbpath")

	--obj:GetFile("select * from t_cfg_area","c:\\area.txt")

	--从数据库新建一个数据集,如果从数据库中取数据，只支持采用ODBC,并且一定要设置SetDB函数
	--area = CTable:new()
	--area:fromString(obj:GetString("select * from t_cfg_area"))
	--area:fromFile("data\\area.txt")

	--从文件新建一个数据集
	--dept =  CTable:new()
	--dept:fromFile("data\\bb.txt")

end

function report()

	--print(mytable:vs(0,0))
	--print(mydept:vs(0,1))

	print(obj:Ok())

	obj:LoadSheetIdx(1)
	obj:SetSheetName(1,"表单位名称")

	obj:SetCell(3,9,"200")
	obj:SetCell(3,10,"400")

	obj:SetStrikethrough(3,10,true);
	obj:SetShadow(3,10,true);

	obj:SetCell(4,4,"测试字体，颜色等")
	obj:SetCell(4,5,"测试字体，颜色等")

	obj:AddReplace("{总金额}","9230.9")


	obj:SetBackColor(3,10,0x909090)

	obj:SetFont(4,4,1234,"宋体",20,2,true,true)


	obj:AddReplace("{Year_Quarter}","2008")
	obj:AddReplace("{aYear}","2009-10")
	obj:AddReplace("{氨氮达标量_下}","严重超标,9001022121.0")

	--obj:AddReplace("{年份}",area:vs(2,"AREA_NAME"))


	obj:LoadSheetIdx(2)


	obj:LoadSheetIdx(1)
	obj:SetTable(11,1,area,1)

	obj:AddReplace("{年份}",area:search("AREA_NAME","杭州市市直属","AREA_ID"))


	--tool:Run("notepad.exe")

end
