Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

ARCHIVOS CUANTITATIVOS, Schemes and Mind Maps of Applied Computing

ARCHIVOS DE COMPUTACION ENFOCADO EN ESTUDIOS CUANTITATIVOS

Typology: Schemes and Mind Maps

2023/2024

Uploaded on 11/20/2024

javier-baron
javier-baron 🇺🇸

1 document

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
import tkinter as tk
from tkinter import filedialog, messagebox
import pandas as pd
from docx import Document
# Variable global para almacenar la ruta del archivo Excel
excel_path = None
def cargar_excel():
global excel_path
# Abre el diálogo para seleccionar el archivo Excel
pf3
pf4
pf5
pf8

Partial preview of the text

Download ARCHIVOS CUANTITATIVOS and more Schemes and Mind Maps Applied Computing in PDF only on Docsity!

import tkinter as tk from tkinter import filedialog, messagebox import pandas as pd from docx import Document

Variable global para almacenar la ruta del archivo Excel

excel_path = None def cargar_excel(): global excel_path

Abre el diálogo para seleccionar el archivo Excel

excel_path = filedialog.askopenfilename( title="Selecciona el archivo Excel", filetypes=(("Archivos Excel", ".xlsx"), ("Todos los archivos", ".*")) ) if excel_path: messagebox.showinfo("Archivo cargado", f"Archivo Excel cargado:\n{excel_path}") def exportar_a_word(): if not excel_path:

if word_template_path:

Cargar datos de Excel

data = pd.read_excel(excel_path)

Cargar el documento de Word como plantilla

doc = Document(word_template_path)

Reemplazar las etiquetas en Word con los datos de

Excel for row in data.iterrows():

for paragraph in doc.paragraphs: if "" in paragraph.text: paragraph.text = paragraph.text.replace("", str(row[1] ["NombreColumna"]))

Guardar el nuevo documento de Word

doc.save("Informe_Tecnologico_Completado.docx") messagebox.showinfo("Exportación completada", "Los datos de Excel se exportaron a Word con éxito.")

btn_cargar_excel = tk.Button(root, text="Cargar Excel", command=cargar_excel) btn_cargar_excel.pack(pady=10)

Botón para exportar a Word

btn_exportar_word = tk.Button(root, text="Exportar a Word con Plantilla", command=exportar_a_word) btn_exportar_word.pack(pady=10) root.mainloop()

Ejecutar la interfaz gráfica

abrir_ventana()