# -*- coding: UTF-8 -*-
import xlwt,uuid,md5,os
from django.conf import settings

def GenEmptyXLSFunc(num_of_row):
	BASE_DIR = os.path.dirname(os.path.dirname(__file__))
	wrxlsname = 'emptyphotoworks-%s.xls' % str(uuid.uuid4())
	wrxlspath = os.path.join(settings.MEDIA_ROOT,'xls',wrxlsname )
	wb = xlwt.Workbook(encoding='utf-8')
	ws = wb.add_sheet("PhotoWorks")
	ws.write(0,0,u'作品ID')
	ws.write(0,1,u'参赛者用户名')
	ws.write(0,2,u'作品标题')
	ws.write(0,3,u'作品描述')
	ws.write(0,4,u'文件名')
	ws.write(0,5,u'文件扩展名')
	for i in range(1,num_of_row+1):
		u=str(uuid.uuid4())
		m=md5.md5(u)
		ms=m.hexdigest()
		ws.write(i,0,u)
		ws.write(i,4,ms)
		ws.write(i,5,"jpg")
	wb.save(wrxlspath)
	return wrxlsname