Oracle Forms Reading Data in Excel Spreadsheet Protected Password.

Dicas do Oracle Forms Builder - Blocos, Itens, LOV, Canvas, Triggers, comandos, PLL, d2kwutil, FMB, Alert, menus, etc
Post Reply
taylormoraes
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 1
Joined: Wed, 09 Jun 2010 5:57 pm
Location: Novo Hamburgo-RS

Hello.
I searched the other topics on how the Forms read information in an Excel spreadsheet.
Beauty!
But, the worksheet I need to get the information, is a password protected worksheet.
That type of protection from Excel's "Save As" of Excel, which needs to post the password to view the information and another password for editing.

Does anyone have any tips?

The code I used to open and read Excel is this below, but before opening the file and read the information, Excel asks to manually enter the password, but I want to automate it!

Select all

declare 
   appid            pls_integer; 
   docid            pls_integer; 
   conv_established boolean := false; 
   v_nm_destino     varchar2(32000); 
   v_ds_classe      varchar2(32000); 
   v_ds_local       varchar2(32000); 
   v_nm_arquivo     varchar2(32000); 
   v_nm_diretorio   varchar2(32000); 
   v_nr_linha       number; 
   v_nr_coluna      number; 
   v_ds_dado        varchar2(32000); 
   -- para abrir o arquivo -- 
begin 
   v_nm_destino     := 'C:\TESTE.XLS'; 
   conv_established := false; 
/* 
   v_ds_classe      := win_api_environment.read_registry('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xls' 
                                                        ,null 
                                                        ,false); 
   v_ds_local       := win_api_environment.read_registry('HKEY_CLASSES_ROOT\' || v_ds_classe || '\shell\open\command' 
                                                        ,null 
                                                        ,false); 
*/ 
   appid := dde.app_begin(nvl(v_ds_local,'C:\Arquivos de programas\Microsoft Office\OFFICE11\EXCEL.EXE') 
                         ,dde.app_mode_minimized); 
   docid := dde.initiate('EXCEL' 
                        ,'SYSTEM'); 
   conv_established := true; 
   dde.execute(docid 
              ,'[Open("' || v_nm_destino || '")]' 
              ,10000); 
   docid := dde.initiate('EXCEL' 
                        ,v_nm_destino); 
   -- para ler o dado -- se o excel for em ingles, ao invez de L usa-se R(row) 
   dde.request(docid 
              ,replace('L2C3' 
                      ,' ') 
              ,v_ds_dado 
              ,dde.cf_text 
              ,100000); 
   -- 
   :BLOCO1.CODIGO := trim(replace(replace(V_DS_DADO,chr(13)),chr(10)) ); 
   -- fecha o excel e o arquivo 
   dde.terminate(docid); 
   dde.app_end(appid); 
end;



Thanks from now on all and any help !!!

Taylor Moraes
davidmeloboy
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 54
Joined: Fri, 05 Sep 2008 1:53 pm
Location: Parobé - RS
Contact:
David.

Hi, I rode and I could not read the data. Something is missing?
I needed to read each column and play for a table.
Renato Menezes Viana
Rank: Analista Pleno
Rank: Analista Pleno
Posts: 128
Joined: Sat, 18 Nov 2006 11:51 am
Location: Rio de Janeiro - RJ

David,

As you are using Win_api (solution at work station) the business is to know well what Excel can do.

checks if the Excel version that will use supports this solution:

1. Configure a macro to be performed automatically in the opening of a workbook
https://support.office.com/pt-br/articl ... omatically
2. With this you will run a macro that opens the spreadsheet that has password
https://www.youtube.com/watch?v=e_iKNNmK-_k
3. Who knows this by this you complement the macro that opens the spreadsheet that has a password and it also always creates another spreadsheet without a password with the same data, and then you can read without problem.

is not the best solution, but I believe that open a light about your problem.

ABS, Renato Viana
Renato Menezes Viana
Rank: Analista Pleno
Rank: Analista Pleno
Posts: 128
Joined: Sat, 18 Nov 2006 11:51 am
Location: Rio de Janeiro - RJ

So David, the topic below also comments on DDE.Request

ABS
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests