PACKAGE BODY EE IS
Enviado por Joel Calix • 2 de Septiembre de 2019 • Ensayo • 759 Palabras (4 Páginas) • 87 Visitas
PACKAGE BODY EE IS
TYPE ExcelCell IS RECORD(RowNo binary_integer,
ColNo binary_integer,
Val varchar2(2000),
FontName varchar2(20),
FontSize binary_integer,
FontStyle binary_integer,
FontColor binary_integer,
BgrColor binary_integer,
Format varchar2(60),
Align xlHAlign,
Linea binary_integer,
NumberFormat varchar2(15),
NoHoja Number DEFAULT null
);
TYPE ExcelCells IS TABLE OF ExcelCell;
Cell ExcelCells := ExcelCells();
CurrentRow binary_integer := 1;
TYPE ExcelCellMerge IS RECORD(
RangoMerge varchar2(20),
NoHoja Number DEFAULT null
);
TYPE ExcelCellsMerge IS TABLE OF ExcelCellMerge;
CellMerge ExcelCellsMerge := ExcelCellsMerge();
TYPE Hoja IS RECORD(Worksheet OLE2.OBJ_TYPE);
TYPE Hojas IS TABLE OF Hoja;
Sheet Hojas := Hojas();
PROCEDURE inicializa_contador IS
BEGIN
CurrentRow :=1;
END;
FUNCTION get_contador RETURN NUMBER IS
BEGIN
return CurrentRow;
END;
PROCEDURE new_line IS
BEGIN
CurrentRow := CurrentRow + 1;
END;
PROCEDURE new_merge(RangoMerge varchar2 DEFAULT null,NoHoja Number DEFAULT null) IS
BEGIN
if RangoMerge is not null then
CellMerge.Extend;
CellMerge(CellMerge.Last).RangoMerge:=RangoMerge;
CellMerge(CellMerge.Last).NoHoja:=NoHoja;
end if;
END;
PROCEDURE new_sheet(Worksheets OLE2.OBJ_TYPE DEFAULT null,nombre varchar2 DEFAULT NULL ) IS
BEGIN
if Worksheets is not null then
Sheet.Extend;
sheet(sheet.Last).Worksheet := OLE2.INVOKE_OBJ(Worksheets,'Add');
OLE2.SET_PROPERTY (sheet(sheet.Last).Worksheet , 'Name',nombre);
end if;
END;
PROCEDURE PUNIRCELDAS(PRANGO VARCHAR2,WORKSHEET OLE2.OBJ_TYPE) IS
RANGO OLE2.OBJ_TYPE;
ARGS OLE2.OBJ_TYPE;
VRANGO VARCHAR2(20);
BEGIN
ARGS := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(ARGS, PRANGO);
RANGO := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'Range', ARGS);
OLE2.DESTROY_ARGLIST(ARGS);
OLE2.SET_PROPERTY(RANGO, 'MergeCells',true);
END;
PROCEDURE put_cell( ColNo binary_integer,
CellValue in varchar2,
FontName in varchar2 DEFAULT null,
FontSize in binary_integer DEFAULT null,
FontStyle in binary_integer DEFAULT null,
FontColor in binary_integer DEFAULT null,
BgrColor in binary_integer DEFAULT null,
Format in varchar2 DEFAULT null,
Align in xlHAlign DEFAULT null,
Linea IN binary_integer DEFAULT null,
NumberFormat varchar2 DEFAULT null,
NoHoja Number DEFAULT null
) IS
BEGIN
Cell.Extend;
Cell(Cell.Last).RowNo := CurrentRow;
Cell(Cell.Last).ColNo := ColNo;
Cell(Cell.Last).Val := CellValue;
Cell(Cell.Last).FontName := FontName;
Cell(Cell.Last).FontSize := FontSize;
Cell(Cell.Last).FontStyle := FontStyle;
Cell(Cell.Last).FontColor := FontColor;
Cell(Cell.Last).BgrColor := BgrColor;
Cell(Cell.Last).Format := Format;
Cell(Cell.Last).Align := Align;
Cell(Cell.Last).Linea := Linea;
Cell(Cell.Last).NumberFormat := NumberFormat;
Cell(Cell.Last).NoHoja := NoHoja;
END;
PROCEDURE run(Application OLE2.OBJ_TYPE) IS
Worksheet OLE2.OBJ_TYPE;
WorkCell OLE2.OBJ_TYPE;
WorkColumn OLE2.OBJ_TYPE;
WorkFont OLE2.OBJ_TYPE;
WorkInterior OLE2.OBJ_TYPE;
WindowWork OLE2.OBJ_TYPE;
ArgList OLE2.LIST_TYPE;
Borders OLE2.OBJ_TYPE;
celdas OLE2.OBJ_TYPE;
RANGO OLE2.OBJ_TYPE;
BEGIN
/*
Worksheets := OLE2.GET_OBJ_PROPERTY(Application,'Worksheets');
Worksheet := OLE2.INVOKE_OBJ(Worksheets,'Add');
OLE2.SET_PROPERTY (Worksheet, 'Name', 'Retenidos');
*/
for K in sheet.LAST .. sheet.FIRST loop
Worksheet:=NULL;
Worksheet:=sheet(K).Worksheet;
WindowWork := OLE2.get_obj_property(Application, 'ActiveWindow');
ole2.set_property(WindowWork,'DisplayGridlines','false');
--MSGADVERTENCIA(K);
for j in CellMerge.First .. CellMerge.Last loop
if CellMerge(j).RangoMerge is not null then
PUNIRCELDAS(CellMerge(j).RangoMerge,Worksheet);
end if;
end loop;
for i in Cell.First .. Cell.Last
loop
--MSGADVERTENCIA(Cell(i).NoHoja);
IF Cell(i).NoHoja=K-1 THEN
-- if Cell(i).Val is not null then
ArgList := OLE2.create_arglist;
OLE2.add_arg(ArgList, Cell(i).RowNo);
ole2.add_arg(ArgList, Cell(i).ColNo);
WorkCell := OLE2.get_obj_property(Worksheet, 'Cells', ArgList);
--celdas := OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', ArgList);
ole2.destroy_arglist(ArgList);
ole2.set_property(WorkCell, 'Value', Cell(i).Val );
ole2.set_property(WorkCell, 'NumberFormat', Cell(i).Format);
--ole2.set_property(WorkCell, 'NumberFormat', '@');
if Cell(i).Align is not null then
ole2.set_property(WorkCell, 'HorizontalAlignment', Cell(i).Align);
end if;
if Cell(i).NumberFormat is not null then
OLE2.SET_PROPERTY(WorkCell, 'Style', 'Comma');
end if;
WorkFont := OLE2.get_obj_property(WorkCell, 'Font');
WorkInterior := ole2.Get_Obj_Property(WorkCell,
...