Commit dfe4602f by Juan

se agrega ancho automatico

1 parent 329cb7e3
......@@ -16,7 +16,7 @@ select = """SELECT dom.name as dominio, pf.create_date, pf.pfs_fecha, cli.name,
koozo_dominios AS dom ON dom.id = comp.ain_dom_id
LEFT JOIN
koozo_localidad AS loc ON loc.id = cli.par_loc_id OR loc.id = pf.pfs_loc_id
) WHERE pf."tws_Tipo" = 'cent' AND pf.create_date >= '01/01/2019 12:00:00 AM' AND pf.create_date <= '01/02/2020 12:00:00 AM'"""
) """
titulos = ["DOMINIO", "DATETIME", "FECHA", "CLENTE", "CALLE", "CALLE2", "LOCALIDAD", "PROBINCIA", "COD POSTAL", "PAIS", "DOMICILIO"]
......@@ -30,7 +30,7 @@ parametros = {
var = json.dumps(parametros)
mpost = requests.post("http://127.0.0.1:11876/", data = var)
#mpost = requests.post("http://192.168.15.69:8080", data = var)
#mpost = requests.post("https://nextcloud.anacsoft.com/apirepote/", data = var)
r = mpost.json()
print(r["Nombre"])
......
......@@ -4,6 +4,11 @@ class Reporte():
COLUMNA = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
"L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "Y", "Z")
anchos = {"A": 12, "B": 12, "C" :12, "D": 12, "E": 12, "F": 12,
"G": 12, "H": 12 , "I": 12, "J": 12, "K": 12,"L": 12, "M": 12,
"N": 12, "O": 12, "P": 12, "Q": 12, "R": 12, "S": 12, "T": 12,
"U": 12, "V": 12, "Y": 12, "Z": 12}
def __init__(self):
self.fecha = time.strftime("%y%m%d")
self.archivo = "tmp/reporte"+ self.fecha + ".xlsx"
......@@ -27,9 +32,18 @@ class Reporte():
for dato in datos:
celda = Reporte.COLUMNA[n] + str(linea)
self.Hoja1.write(celda, str(dato), formato)
self.__calculoAncho__(n, dato)
n = n + 1
self.ancho = Reporte.COLUMNA[n]
def __calculoAncho__(self, n, dato):
"""incremento el valor de una columna en funcion de la cantidad de letras"""
letras = len(str(dato))
lmaximo = Reporte.anchos[Reporte.COLUMNA[n]]
if letras > lmaximo:
print(Reporte.COLUMNA[n], letras)
Reporte.anchos.update({Reporte.COLUMNA[n]: letras})
def __escribir_global(self):
n = 2
for query in self.QUERY:
......@@ -39,8 +53,11 @@ class Reporte():
def __ajuste__(self):
Pn = self.ancho + self.alto
#self.Hoja1.add_table("A1:"+Pn, {'autofilter': 0})
print(Pn)
for columna in Reporte.anchos.keys():
a = Reporte.anchos[columna]
print(columna, a)
self.Hoja1.set_column(columna+":"+columna, a)## esa desde hasta A:A
def __encabesado__(self):
print(self.Encabesado)
......
[Dolphin]
Timestamp=2020,2,25,22,23,16
Version=4
ViewMode=1
No preview for this file type
No preview for this file type
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!