Home » Developer & Programmer » Forms » Please Help :( (Windows 7 - Oracle Form 6i - OpenOffice)
Please Help :( [message #636051] Wed, 15 April 2015 10:54 Go to next message
WebmasterObst
Messages: 2
Registered: April 2015
Location: Lima
Junior Member
Hi EveryBody;

I have a problem .. Sad
I want to create an Excel File and after create, I would like to Save this file into the computer - choosing the directory or default ('C:\Exports_Oracle\')

With mi code, I just create and display in excel.

But I would like to save it - not open after save- just save into the pc. (choosing directory or default ('C:\Exports_Oracle\')

Please, I beg you, each of one.. Help me..




declare
		application			ole2.obj_type;
		workbooks				ole2.obj_type;
		workbook				ole2.obj_type;
		worksheet1			ole2.obj_type;
		args						ole2.list_type;
	
		ln_fore_r       number;
		ln_fore_g       number;
		ln_fore_b       number;
		ln_fore_titu_r  number;
		ln_fore_titu_g  number;
		ln_fore_titu_b  number;
		ln_back_r       number;
		ln_back_g       number;
		ln_back_b       number;
		ln_back_titu_r  number;
		ln_back_titu_g  number;
		ln_back_titu_b  number;
		x								number;
		y								number;
		i								number;
		i2							number;
		LN_max          number;
				
BEGIN
	
		
		set_application_property(cursor_style,'busy');
		application:=ole2.create_obj('EXCEL.application');
		workbooks:=ole2.get_obj_property(application, 'workbooks');
		workbook:=ole2.get_obj_property(workbooks,'add',args);
		args:=ole2.create_arglist;
		ole2.add_arg(args,1);	
  
		worksheet1:=ole2.get_obj_property(workbook,'worksheets',args);
		ole2.destroy_arglist(args);
		ole2.set_property(worksheet1,'select',1);
		ole2.set_property(worksheet1,'name','Libro1');
	  ------------------------------------------------------------------------------------------------------                   
	                ln_fore_titu_r := get_rgb(get_va_property('vis_titulo',foreground_color),'R');
                  ln_fore_titu_g := get_rgb(get_va_property('vis_titulo',foreground_color),'G');
                  ln_fore_titu_b := get_rgb(get_va_property('vis_titulo',foreground_color),'B');
                  ln_back_titu_r := get_rgb(get_va_property('vis_titulo',background_color),'R');
                  ln_back_titu_g := get_rgb(get_va_property('vis_titulo',background_color),'G');
                  ln_back_titu_b := get_rgb(get_va_property('vis_titulo',background_color),'B');
   
    excel.crea_celda(worksheet1, 2, 2, 20,  'CODIGO LINEA' , null, null, null, 3, 1, 'Arial Black', 8, 0,excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 3, 2, 20,  'CODIGO MAQUINARIA' , null, null, null, 3, 1, 'Arial Black', 8, 0,excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 4, 2, 20,  'DESCRIPCION MAQUINARIA', null, null, null, 3, 1, 'Arial Black', 8, 0,excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 5, 2, 20,  'NRO. DE SOLICITUD',   null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 6, 2, 20,  'NRO. DE PEDIDO',      null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 7, 2, 20,  'FECHA INICIO SOLICITUD',    null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 8, 2, 20,  'HORA INICIO SOLICITUD',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 9, 2, 20,  'ESTIMADO PROMEDIO',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 10, 2, 20,  'FECHA INICIO REPORTE',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 11,2, 20,  'HORA INICIO REPORTE',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 12,2, 20,  'FECHA FIN REPORTE',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  excel.crea_celda(worksheet1, 13,2, 20,  'HORA FIN REPORTE',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1);
	  excel.crea_celda(worksheet1, 14,2, 20,  'ESTIMADO PROMEDIO',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  excel.crea_celda(worksheet1, 15,2, 20,  'FECHA INICIO PADIF',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  excel.crea_celda(worksheet1, 16,2, 20,  'HORA INICIO PADIF',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  excel.crea_celda(worksheet1, 17,2, 20,  'FECHA FIN PADIF',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  excel.crea_celda(worksheet1, 18,2, 20,  'HORA FIN PADIF',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  excel.crea_celda(worksheet1, 19,2, 20,  'ESTIMADO PADIF',null, null, null, 3, 1, 'Arial Black', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),1); 
	  
	  ----------------------------------------------------------------------------------------------------------
	  --BLOQUE ARTICULO
	  go_block('V_CONSULTAMAQUINAS');
    last_record;
    LN_max := to_number(:system.cursor_record);
    first_record;
    y:=0;
	  FOR i IN 1..LN_max LOOP
	  	  y := y+1;
		    x := 0;
		    
		    
		              ln_fore_titu_r := get_rgb(get_va_property('VISUAL_ATTRIBUTE730',foreground_color),'R');
                  ln_fore_titu_g := get_rgb(get_va_property('VISUAL_ATTRIBUTE730',foreground_color),'G');
                  ln_fore_titu_b := get_rgb(get_va_property('VISUAL_ATTRIBUTE730',foreground_color),'B');
                  ln_back_titu_r := get_rgb(get_va_property('VISUAL_ATTRIBUTE730',background_color),'R');
                  ln_back_titu_g := get_rgb(get_va_property('VISUAL_ATTRIBUTE730',background_color),'G');
                  ln_back_titu_b := get_rgb(get_va_property('VISUAL_ATTRIBUTE730',background_color),'B');

		 		
		    
		    excel.crea_celda(worksheet1, x+2, y+2, 20,:V_CONSULTAMAQUINAS.RGSCODLINEA,null,null,null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
        excel.crea_celda(worksheet1, x+3, y+2, 20,:V_CONSULTAMAQUINAS.RGSCODMQN,null,null,null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
        excel.crea_celda(worksheet1, x+4, y+2, 20,:V_CONSULTAMAQUINAS.ITEM36, null,null ,null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null);
        excel.crea_celda(worksheet1, x+5, y+2, 20,:V_CONSULTAMAQUINAS.RGSNUMSOL,null,null , null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null);
			  excel.crea_celda(worksheet1, x+6, y+2, 20,:V_CONSULTAMAQUINAS.RGSNUMPED, null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+7, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSFECHAINISOL,'DD/MM/YYYY','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+8, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSHRAINISOL,'HH24:MI:SS','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+9, y+2, 20,CHR(39)||:V_CONSULTAMAQUINAS.RGSESTIMADOPROM, null, null, null, 2, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
				--excel.crea_celda(worksheet1, x+9, y+2, 20,:V_CONSULTAMAQUINAS.RGSESTIMADOPROM, null, null, null, 2, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+10, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSFECHAINIRPT,'DD/MM/YYYY','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 4, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+11, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSHRAINIRPT,'HH24:MI','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+12, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSFECHAFINRPT,'DD/MM/YYYY','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
        excel.crea_celda(worksheet1, x+13, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSHRAFINRPT,'HH24:MI','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 2, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+14, y+2, 20,:V_CONSULTAMAQUINAS.RGSESTIMADORPT, null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
        excel.crea_celda(worksheet1, x+15, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSFECHAINIPDF,'DD/MM/YYYY','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 4, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+16, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSHRAINIPDF,'HH24:MI','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+17, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSFECHAFINPDF,'DD/MM/YYYY','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
        excel.crea_celda(worksheet1, x+18, y+2, 20,TO_CHAR(:V_CONSULTAMAQUINAS.RGSHRAFINPDF,'HH24:MI','NLS_DATE_LANGUAGE = AMERICAN'), null, null, null, 2, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
			  excel.crea_celda(worksheet1, x+19, y+2, 20,:V_CONSULTAMAQUINAS.RGSESTIMADOPDF, null, null, null, 3, 1, 'Arial', 8, 0, excel.color_rgb(ln_fore_titu_r,ln_fore_titu_g,ln_fore_titu_b), 1, excel.color_rgb(ln_back_titu_r,ln_back_titu_g,ln_back_titu_b),null); 
        
        IF i <> LN_max THEN
              next_record;
        END IF;
	  END LOOP;
	  ---
	  y :=18;
		ole2.set_property(worksheet1, 'select',1);
		ole2.set_property(application,'Visible', 1);

		ole2.release_obj(worksheet1);
		ole2.release_obj(workbook);
		ole2.release_obj(workbooks);
		ole2.release_obj(application);

		set_application_property(cursor_style,'default');
		
		util.aceptar('al_ac','La generación del Excel culminó satisfactoriamente');
END;

Re: Please Help :( [message #636052 is a reply to message #636051] Wed, 15 April 2015 11:08 Go to previous messageGo to next message
WebmasterObst
Messages: 2
Registered: April 2015
Location: Lima
Junior Member
Please I beg you!!!

I need a little help.
The code is on my button : Exportar_Excel

Re: Please Help :( [message #636090 is a reply to message #636052] Thu, 16 April 2015 09:11 Go to previous message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
If you are using OpenOffice.org instead of MS-Office then the code you are using will not work because the "application:=ole2.create_obj('EXCEL.application');" is specific to MS-Office. You need to find the OLE name for Open Office's Calc program. Also, you will need to find Calc equilvilents of all the Excel objects you are trying to set through OLE. I recommend you start with the Apache OpenOffice Module Document and Apache OpenOffice Spreadsheet Documents.

Craig...
Previous Topic: REPORT NOT RUNNING AS SHOULD WHEN HANGING THROUGH A FORM
Next Topic: ORACLE FORMS 10G
Goto Forum:
  


Current Time: Tue Apr 23 19:19:23 CDT 2024