Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General Discussion » View Thread |
Messages 1 to 10 of 18 total |
Embedding Documents as BLOBS and Using Host Applications (OLE?) |
Mon, Feb 27 2006 5:30 PM | Permanent Link |
"Johnnie Norsworthy" | I want to be able to import documents into my program and save them as
BLOBs. No problem there. After they are imported, I would like any user to be able to edit these BLOB'd documents using whatever application assigned to the file type: .DOC MS-Word, etc. How would I go about doing this without downloading the document to a temporary file, launching the application (only if installed), and then watching for it to close, then save the document back. I guess this would have to be OLE, but I have never done that, other than embedding IE into a few applications. Any pointers or informative web site or books? My application will be client/server with no file connection to the server's underlying directory structure for saving the files directly. Thanks for any pointers! -Johnnie |
Tue, Feb 28 2006 5:29 AM | Permanent Link |
"Mike Shkolnik" | It depends how did you save the documents in your BLOB-field.
If you used the TOLEContainer.SaveToStream, then you may use the TOLEContainer.LoadFromStream and work with document in embedded TOLEContainer without any temporary file. But if you saved in BLOB the original documents as files (doc-file, xls-file etc) then to use the temporary file is only one way because you can't load the document to MS Word, MS Excel from stream. They works with files only. -- With best regards, Mike Shkolnik EMail: mshkolnik@scalabium.com http://www.scalabium.com "Johnnie Norsworthy" <jln206@verizon.net> wrote in message news:938D5799-51A2-4DA9-9E93-E97192E9DA90@news.elevatesoft.com... > I want to be able to import documents into my program and save them as > BLOBs. No problem there. > > After they are imported, I would like any user to be able to edit these > BLOB'd documents using whatever application assigned to the file type: ..DOC > MS-Word, etc. > > How would I go about doing this without downloading the document to a > temporary file, launching the application (only if installed), and then > watching for it to close, then save the document back. > > I guess this would have to be OLE, but I have never done that, other than > embedding IE into a few applications. Any pointers or informative web site > or books? > > My application will be client/server with no file connection to the server's > underlying directory structure for saving the files directly. > > Thanks for any pointers! > > -Johnnie > > |
Tue, Feb 28 2006 10:38 AM | Permanent Link |
"Johnnie Norsworthy" | "Mike Shkolnik" <mshkolnik2002@ukr.net> wrote in message
news:C0BCFC0F-020B-4F10-8CB2-8700DB01A095@news.elevatesoft.com... > It depends how did you save the documents in your BLOB-field. > > If you used the TOLEContainer.SaveToStream, then you may use the > TOLEContainer.LoadFromStream and work with document in embedded > TOLEContainer without any temporary file. > > But if you saved in BLOB the original documents as files (doc-file, > xls-file > etc) then to use the temporary file is only one way because you can't load > the document to MS Word, MS Excel from stream. They works with files only. I was Googling for OleContainer last night and read a bit about it. I think it would be best to allow *creating* files in the standalone program, such as MS-Word, then store those files as BLOB fields with a separate "original file name" field. Then when editing is required, extract the BLOB to that file name in a temporary folder, but intercept the "Save" event of the host program and use that to update the BLOB. or the best approach ... when editing is required, load it into an embedded OleContainer and allow editing and saving back to the BLOB. Are either of these possible scenarios? -Johnnie |
Wed, Mar 1 2006 6:45 AM | Permanent Link |
Michael Baytalsky | Hi Johnnie,
Actually, the right way to do it, would be to implement necessary Ole interfaces for streaming, so that Word or other Ole enabled server will regard your application as a container of embedded Ole object. Then you will be able to invoke Word to edit embedded object and know when it's saved back - Word will use the interfaces you provide. This is not very easy to do, though . However, working with temp files I'm not sure how you're going to track the fact, that Word has saved the document, so you need to reload it? So, back to Ole containers... Most of what's necessary is done by TOleContainer. You can load an object into container from a disk file, using: OleContainer1.CreateObjectFromFile(FileName, True/False {Iconic}); Then you can execute 'open' verb or have user activate it. (I don't recommend inplace activation). In my test it worked best when I set AllowActiveDoc = False AllowInPlace = False (somehow, this doesn't prevent inplace activation anyway). Then, when you need to move to the next record or next document, use if OleContainer1.Modified then OleContainer1.SaveAsDocument(FileName); (this is tested and works fine). For some reason they don't provide you with callback when an object was modified, but you can check on its Modified field when necessary. Also, you can check container's State and Linked properties to know if you should prompt user to close opened document before proceeding. IOW, using container you can work with Ole documents both saved into stream (as Mike suggested above) and saved as documents (via CreateObjectFromFile/SaveAsDocument). In latter case you will have to save it to a temporary file first. The benefit of it would be that your documents are saved as files within blob, so you can always extract them to file without having to have corresponding Ole server on that computer. Regards, Michael Johnnie Norsworthy wrote: > "Mike Shkolnik" <mshkolnik2002@ukr.net> wrote in message > news:C0BCFC0F-020B-4F10-8CB2-8700DB01A095@news.elevatesoft.com... >> It depends how did you save the documents in your BLOB-field. >> >> If you used the TOLEContainer.SaveToStream, then you may use the >> TOLEContainer.LoadFromStream and work with document in embedded >> TOLEContainer without any temporary file. >> >> But if you saved in BLOB the original documents as files (doc-file, >> xls-file >> etc) then to use the temporary file is only one way because you can't load >> the document to MS Word, MS Excel from stream. They works with files only. > > I was Googling for OleContainer last night and read a bit about it. > > I think it would be best to allow *creating* files in the standalone > program, such as MS-Word, then store those files as BLOB fields with a > separate "original file name" field. > > Then when editing is required, extract the BLOB to that file name in a > temporary folder, but intercept the "Save" event of the host program and use > that to update the BLOB. > > or the best approach ... > > when editing is required, load it into an embedded OleContainer and allow > editing and saving back to the BLOB. > > Are either of these possible scenarios? > > -Johnnie > > |
Wed, Mar 1 2006 8:20 AM | Permanent Link |
"Johnnie Norsworthy" | Michael,
Thank you very much for this detailed response. I am going to start some testing today. -Johnnie |
Wed, Mar 1 2006 8:25 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Johnnie
When you've built a test project can I have a copy please. Roy Lambert |
Wed, Mar 1 2006 8:39 AM | Permanent Link |
"Johnnie Norsworthy" | "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message
news:ACE0BB65-2EE8-4661-8C90-897970CA0241@news.elevatesoft.com... > > When you've built a test project can I have a copy please. No problem! |
Wed, Mar 1 2006 12:22 PM | Permanent Link |
"Johnnie Norsworthy" | I just thought about a more universal approach that might work for my
application. When a user wants to edit a BLOB'd document, I save the blob to a file with the appropriate file name in a temporary location, then start a new process to 'edit' or 'open' that document, which should start the appropriate application. I can monitor when that process ends to know to read the document back into the BLOB. If my application is closed, I warn the user if any of the processes started has not been closed since being opened by my application. Does this sound feasible, or am I missing something obvious? Thanks, Johnnie |
Wed, Mar 1 2006 1:09 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Johnnie
What happens if they open a BLOB'd document in Word, whilst in there open 3 other documents and never close the process, or if Word is already running...... Roy Lambert |
Wed, Mar 1 2006 1:20 PM | Permanent Link |
Michael Baytalsky | > When a user wants to edit a BLOB'd document, I save the blob to a file with > the appropriate file name in a temporary location, then start a new process > to 'edit' or 'open' that document, which should start the appropriate > application. > I can monitor when that process ends to know to read the document back into > the BLOB. What if it doesn't end after closing the document (say you open another document in same process)? > If my application is closed, I warn the user if any of the processes started > has not been closed since being opened by my application. > > Does this sound feasible, or am I missing something obvious? I guess you can do that if you know how to start the appropriate process. IMO, ShellExecute should return the instance handle, so then you can use GetExitCodeProcess to query process status <> STILL_ACTIVE. I see no obvious problems, you might need to experiment with it. The advantage of OleContainer is that you will have control over Ole server application and will be able to execute commands if you need to (even force it to save the document and close). However, Ole is only good on MS products and will not be portable to Linux if you ever need that. Regards, Michael |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Friday, March 29, 2024 at 03:30 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |