Home » Developer & Programmer » Forms » Open word which is stored in database. And Re-store the modified file in the database (Forms [32 Bit] Version 10.1.2.3.0, WindowsXP)
Open word which is stored in database. And Re-store the modified file in the database [message #445101] Thu, 25 February 2010 22:22 Go to next message
havok
Messages: 36
Registered: February 2010
Member
Hi!
I create a trigger that reads the BLOB field to the document msWord. After completion, restore to the table to BLOB field modified document.
declare
	
	my_cmd Varchar2(128) ;		-- comand in cmd to open file
	my_path Varchar2(128);		-- path to tmp file
	my_nom Varchar2(100) ;		-- name of tmp fayla
	my_fic Varchar2(128);			-- fullname of tmp fayla
	ln_But Pls_Integer ;			-- somthing
	proc_id WEBUTIL_HOST.PROCESS_ID;
	blob_nomer number;				-- nomer stroki (blob-polya)
	flag boolean;

begin
	
	blob_nomer:=1;	
	if(:LEMDOK_468.NITEM is not null)	then
			blob_nomer:=:LEMDOK_468.NITEM;
	end if;

	my_path := 'D:\';
	my_nom:='tmp' || blob_nomer || '.doc';
	my_fic := my_path || my_nom ;
	--display_mess(my_fic);
 	flag:=WEBUTIL_FILE.DELETE_FILE( my_fic );
 	
	IF not webutil_file_transfer.db_to_client(
				 		my_fic, -- the name where the file should be stored locally
            'FIRST_TEST_IVAN', -- the table-name of the table where your blob is stored in
            'FILE_WORD',-- the column-name of the BLOB-column
            'nomer = ' || blob_nomer  -- the WHERE-clause needed to select the appropiate record from the table
            ) THEN
			display_mess('NOT load');
			Raise Form_trigger_Failure ;
	END IF;
	
	my_cmd := 'cmd /c start "" /WAIT "' || my_fic || '"' ;
	proc_id := WEBUTIL_HOST.Blocking( my_cmd ) ;
	-- open temp file and block form. After exit from msWord perform next commands
	
	
	-- Re-store the modified file in the database --
	IF not webutil_file_transfer.client_to_DB(
				 		my_fic, -- the name where the file should be stored locally 
            'FIRST_TEST_IVAN', -- the table-name of the table where your blob is stored in
            'FILE_WORD',-- the column-name of the BLOB-column
            'nomer = ' || blob_nomer  -- the WHERE-clause needed to select the appropiate record from the table
            ) THEN
			display_mess('NOT saved');
			Raise Form_trigger_Failure ;
	else
			display_mess('has saved');
			If WEBUTIL_FILE.DELETE_FILE( my_fic ) = FALSE Then
					display_mess('NOT deleted');
					Bell ;
			ELSE
					display_mess('has deleted');			
			End if ; 
	End if;

	Clear_Message ;

end;


But how to make the form is not blocked? And to make users can open a lot of files from different blob fields? If I use WEBUTIL_HOST.NonBlocking, then the form opens word and immediately executes the following commands (saves only the open document). Help Please! Wink

[Updated on: Thu, 25 February 2010 22:28]

Report message to a moderator

Re: Open word which is stored in database. And Re-store the modified file in the database [message #447108 is a reply to message #445101] Thu, 11 March 2010 22:53 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Sorry that I have been so long in replying. Have you solved your problem?

It sounds as though you need to call a separate copy of the form for each file (use 'open_form').

David
Re: Open word which is stored in database. And Re-store the modified file in the database [message #447113 is a reply to message #445101] Thu, 11 March 2010 23:00 Go to previous message
havok
Messages: 36
Registered: February 2010
Member
Yes.There was a problem with the comand.
This is the correct line
proc_id := WEBUTIL_HOST.NonBlocking_With_Callback( 'cmd /c start /WAIT WINWORD /W "' || filename || '"', 'CALL_BACK' ) ;
Previous Topic: create Iconic Buttons in Forms 9iDS
Next Topic: populate_list for non database field
Goto Forum:
  


Current Time: Fri Sep 20 00:40:19 CDT 2024