Oracle - Ayudenme por favor

 
Vista:
sin imagen de perfil

Ayudenme por favor

Publicado por Cristopher Alexis (1 intervención) el 15/04/2015 22:40:41
Buenas Tardes...

Hola a todos los participantes de : La Web del Programador!! :D

Tengo un gran problema , mis estimados eruditos en oracle :(
Quiero generar un archivo excel. desde mi oracle form en mi boton : exportar excel.
Lo unico que he logrado es generar el archivo excel y mostrarlo.

Pero ahora no quiero mostrarlo.
Lo que quiero es que el archivo se guarde "automaticamente" en el escritorio, sin abrir.. solo guardar en el escritorio automaticamente

Alguna idea alli por favor?


Mi codigo para exportar excel es:
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;

out_file Text_IO.File_Type;
flnm varchar2(2000);

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','Exportado');
------------------------------------------------------------------------------------------------------
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', 'FALSE');

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;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder