Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-06-2022
emeritos emeritos is offline
Miembro
 
Registrado: may 2003
Posts: 307
Poder: 21
emeritos Va por buen camino
crear varias tablas en word

Buenas estoy haciendo desde delphi7 un word y debo de crear varias tablas independiente. Este es mi codigo:

Código PHP:
    Documento := ExtractFilePathApplication.ExeName ) + ficheropdf '.docx';
    
Word.Connect;
    
Word.Documents.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam);
    
with Word do
        
Begin
          with Selection 
do
              
Begin
                  with Sections
.Item(1).Headers.Item(1).Range do
                      
Begin
                          Font
.Name := 'Arial';
                          
Font.Bold := 1;
                          
Font.Size := 14;
                          
Font.Color := clRed;
                          
Text := 'xxxxxxxxxxxxxxxxxxx ';
                          
Paragraphs.Item(1).Alignment := 1// centramos párrafo
                      
End;


                  
TypeText#13 + #13);
                   
Font.Name := 'Arial';
                   
Font.Size := 14;
                   
Font.Color := clBlack;
                   
Font.Bold := 1;
                   
TypeText'Formación NO Reglada');
                   
Font.Color := clBlue;
                   
Font.Size := 14;
                   
Paragraphs.Item(1).Alignment := 1// centramos párrafo

                   
sw_filastotal := 5;
 
                   
// Insertamos una tabla con fuente de color negro
                   
Font.Color := clBlack;
                   
with Tables.AddRangesw_filastotal3EmptyParamEmptyParam ) do
                              
begin
                                  
// Borde la la tabla
                                  
Borders.Enable := 1;

                                  
// Títulos y ancho de las columnas de la tabla
                                  
Cell(1,1).Range.Text := 'xxxxxxxxx';
                                  
Cell(1,1).Width := 200;
                                  
Cell(1,1).RightPadding;

                                  
Cell(1,2).Range.Text := ' Horas ';
                                  
Cell(1,2).Width := 60;

                                  
Cell(1,3).Range.Text := ' Puntos ';
                                  
Cell(1,3).Width := 60;

                                  
Rows.Item(1).Shading.BackgroundPatternColor := clGreen// fonfo verde
                                  
Rows.Item(1).Range.Font.Color := clYellow// fuente amarilla

                                  
MQreglada.First;
                                  While 
Not MQreglada.Eof do
                                        
Begin
                                            
// Anchura de las Celdas
                                            
Cell(sw_filas,1).Width := 200;
                                            
Cell(sw_filas,2).Width := 60;
                                            
Cell(sw_filas,3).Width := 60;

                                            
// Contenido
                                            
Cell(sw_filas,1).Range.Text := MQreglada['nombrereglada'];
                                            
Cell(sw_filas,2).Range.Text := MQreglada['horas'];
                                            
Cell(sw_filas,3).Range.Text := MQreglada['puntos'];;
                                            
sw_filas := sw_filas 1;
                                            
MQreglada.Next;
                                        
End;
                              
end;



                     
End;
                  
MQreglada.Close;

///// A partir de aqui me lo crea todo en la celda 1,1

                  
TypeText#13 + #13);
                  
Font.Name := 'Arial';
                  
Font.Size := 14;
                  
Font.Color := clBlack;
                  
Font.Bold := 1;
                  
TypeText'dddddddddddddddddddddd');
                  
Font.Color := clBlue;
                  
Font.Size := 14;
                  
with Tables.AddRangesw_filastotal3EmptyParamEmptyParam ) do
                                
begin
                                    
// Borde la la tabla
                                    
Borders.Enable := 1;

                                    
// Títulos y ancho de las columnas de la tabla
                                    
Cell(1,1).Range.Text := 'hhhhhhhhhhhhhhhhh';
                                    
Cell(1,1).Width := 100;
                                    
Cell(1,1).RightPadding;

                                    
Cell(1,2).Range.Text := ' Meses ';
                                    
Cell(1,2).Width := 60;

                                    
Cell(1,3).Range.Text := ' Puntos ';
                                    
Cell(1,3).Width := 60;

                                    
Rows.Item(1).Shading.BackgroundPatternColor := clGreen// fonfo verde
                                    
Rows.Item(1).Range.Font.Color := clYellow// fuente amarilla

                                    
MQexperiencia.First;
                                    While 
Not MQexperiencia.Eof do
                                          
Begin
                                              
// Anchura de las Celdas
                                              
Cell(sw_filas,1).Width := 100;
                                              
Cell(sw_filas,2).Width := 60;
                                              
Cell(sw_filas,3).Width := 60;

                                              
// Contenido
                                              
Cell(sw_filas,1).Range.Text := MQexperiencia['nombreexperiencia'];
                                              
Cell(sw_filas,2).Range.Text := MQexperiencia['meses'];
                                              
Cell(sw_filas,3).Range.Text := MQexperiencia['puntos'];;
                                              
sw_filas := sw_filas 1;
                                              
MQexperiencia.Next;
                                          
End;
                                
end;
                     
End;
                  
MQexperiencia.Close;

              
End;
        
End;


    
// Grabar y cerra documento
    
Word.ActiveDocument.SaveAsDocumento,
      
EmptyParamEmptyParamEmptyParamEmptyParamEmptyParamEmptyParam,
      
EmptyParamEmptyParamEmptyParamEmptyParamEmptyParamEmptyParam,
      
EmptyParamEmptyParamEmptyParam );
    
Word.Quit;
    
Word.Disconnect;
    
Word.Free
Lo primero es que la primera tabla me la crea bien y la segunda me la coloca en la celda (1,1) (junto tambien al su encabezado), de la primera tabla y no se distinguir entre la primera y la segunda aunque no es importante por que lo que quiero es crearla una debajo de la otra.

Gracias.

Última edición por Casimiro Notevi fecha: 14-06-2022 a las 16:22:33.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
consultas de un id en varias tablas novato_erick SQL 4 21-12-2013 19:07:56
Facturacion con varias tablas DOS Varios 44 20-11-2012 03:12:22
Crear Tablas Word Desde Delphi ciscu Servers 10 09-01-2007 17:44:01
consulta de varias tablas elprimo Tablas planas 3 03-01-2007 10:23:15
Escribiendo en varias tablas maravert Tablas planas 1 20-10-2005 17:53:16


La franja horaria es GMT +2. Ahora son las 22:16:17.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi