Ver Mensaje Individual
  #1  
Antiguo 04-09-2017
pollo_c pollo_c is offline
Miembro
 
Registrado: oct 2006
Posts: 55
Reputación: 18
pollo_c Va por buen camino
Ajustar ancho y alto una celda de excel

Estimados:
Solicito su apreciable ayuda para ampliar el alto y ancho de una celda de excel, tengo el siguiente codigo solo me falta ajustar los tamaños de las celdas.

Código Delphi [-]
  Variant Excel,Libro,Hoja,Celda;
  int hoja=1,fil=1;
  char f[256];
  Excel=CreateOleObject("Excel.Application");
  Excel.OlePropertySet("Visible", true);
  Libro=Excel.OlePropertyGet("Workbooks");
  Libro.OleProcedure("Add");
  Hoja=Libro.OlePropertyGet("Item",1);
  Libro=Hoja.OlePropertyGet("Worksheets");

  Libro.OlePropertyGet("Item",1).OlePropertySet("Name","COMPUMUNDO INOVATEC");
///  Libro.OlePropertyGet("Item",2).OlePropertySet("Name","The yellow book-keeping ");

  Hoja=Libro.OlePropertyGet("Item",hoja);


  DataModule1->QAuxPueblos->Close();
  DataModule1->QAuxPueblos->SQL->Clear();
  DataModule1->QAuxPueblos->SQL->Add("SELECT * FROM regiones");
  DataModule1->QAuxPueblos->Open();
  DataModule1->QAuxPueblos->First();
  while (!DataModule1->QAuxPueblos->Eof)
  {

    DataModule1->CAuxRep->Close();
    DataModule1->CAuxRep->SQL->Clear();
    DataModule1->CAuxRep->SQL->Add("SELECT 
    id_rep,fecha_rep,nombre_rep,falla_rep,numero_tel,id_pue,direc_rep,reg.dscr_r,id_usu,edo_rep,id_tec,s  olucion FROM REPORTES rep,  
    regiones reg where rep.inc_r=reg.inc_r and edo_rep=0 and rep.inc_r= "+DataModule1->QAuxPueblos->FieldByName("inc_r")->Text);
    DataModule1->CAuxRep->Open();
    DataModule1->CAuxRep->First();

    strcpy(f, DataModule1->QAuxPueblos->FieldByName("dscr_r")->Text.c_str());
    Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,1).OlePropertySet("Value",f);
    fil++;

    while (!DataModule1->CAuxRep->Eof)
   {
      strcpy(f, DataModule1->CAuxRep->FieldByName("id_rep")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,1).OlePropertySet("Value",f);
      //Hoja.OlePropertyGet("Cells").OlePropertyGet("AutoFit",fil,1);

      strcpy(f, DataModule1->CAuxRep->FieldByName("fecha_rep")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,2).OlePropertySet("Value",f);
      strcpy(f, DataModule1->CAuxRep->FieldByName("nombre_rep")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,3).OlePropertySet("Value",f);
      strcpy(f, DataModule1->CAuxRep->FieldByName("falla_rep")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,4).OlePropertySet("Value",f);
      strcpy(f, DataModule1->CAuxRep->FieldByName("numero_tel")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil, 5).OlePropertySet("Value",f);
      strcpy(f, DataModule1->CAuxRep->FieldByName("id_pue")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,6).OlePropertySet("Value",f);
      strcpy(f, DataModule1->CAuxRep->FieldByName("direc_rep")->Text.c_str());
      Hoja.OlePropertyGet("Cells").OlePropertyGet("Item",fil,7).OlePropertySet("Value",f);
      fil++;
      DataModule1->CAuxRep->Next();
    }
   DataModule1->QAuxPueblos->Next();
   fil+=6;
  } // fin del ciclo para mover hojas

  Excel.OlePropertySet("DisplayAlerts",false); //suppress the warning dialog on closing the server
  Excel.OlePropertyGet("Workbooks").OlePropertyGet("Item",1).OleProcedure("SaveAs","test.xls");
  //Excel.OleProcedure("Quit"); Cierra el libro abierto
  Excel=Unassigned;



Saludos.

Última edición por Casimiro Notevi fecha: 04-09-2017 a las 17:31:58.
Responder Con Cita