• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

VB Control for Word Processing of multiple formats (Word, Excel, TXT, PDF, etc)

Within my application, I'm currently using OLE Automation that allows a user to import an existing document of  Word or Text format.  Once imported, the user can View the file.

But I'm searching for a more powerful control that will allow the user to import a document into the application which will support the following formats Word, Excel, Text and most importantly, PDF...and still be able to view the document imported within the application.

Think of it as MS Word but without capability of making modifications to the document.

This question may not be so much as technical...unless someone has VB Code to handle my criteria, but rather more of a question if someone knows of an existing control or software tool that can be useful in a VB Project.  So for me...and my application I give this higher points rated on it's level of importance more than the level of difficulty.  Although, this has been difficult for me because I have yet to find a control from my internet searchings.  
0
WizeOne
Asked:
WizeOne
  • 10
  • 7
  • 3
  • +3
1 Solution
 
Dave_GreeneCommented:
How are you importing a file?  CommonDialog?  Commandline?
0
 
ArkCommented:
Use Webbrowser control

Cheers
0
 
WizeOneAuthor Commented:
Dave,
I'm importing the file by use of CommonDialog.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Dave_GreeneCommented:
Well then you can set your OLE container to whichever object you want to create.

Here is an example of creating an instance of MediaPlayer on the fly.  In this example the MP2 Object is dimensioned as "MediaPlayer.MediaPlayer" so that you can have control over the events the OLE object will create.  See EndofStream method...

Add an OLE container to your form and add this code.

Option Explicit

Private WithEvents MP2 As MediaPlayer.MediaPlayer

Private Sub Form_Load()
 
 With OLE1
   .CreateEmbed vbNullString, "MediaPlayer.MediaPlayer.1"
   Set MP2 = .object
 End With
 
 MP2.filename = "C:\bong.wav"
 MP2.ShowDisplay = False
 MP2.ClickToPlay = True

End Sub

Private Sub MP2_EndOfStream(ByVal Result As Long)
 MsgBox "EOS"
End Sub
0
 
Dave_GreeneCommented:
So for your application

you would parse out the commondialog filename for it's extension and create the object accordingly

Select Case strExt
  Case "Doc"
    OLE1.CreateEmbed vbNullString, "Word.Application"
  Case "Xls"
    OLE1.CreateEmbed vbNullString, "Excel.Application"
  Case ETC...
End Select

Set MyOle = Ole1.object


 
     
0
 
WizeOneAuthor Commented:
Dave,
I'll try this ... but I was kind of hoping to get rid of OLE Automation since it uses up a lot of resources.
0
 
Dave_GreeneCommented:
You could get rid of it.  What do you want to do with the documents/ spreadsheets... whatever?  Just view them?
0
 
WizeOneAuthor Commented:
Dave,
I'll try this ... but I was kind of hoping to get rid of OLE Automation since it uses up a lot of resources.
0
 
WizeOneAuthor Commented:
Dave,
Your code works for Word, Excel, Tif files, etc but I'm not able to get OLE to support PDF files.  Any thoughts?
Maybe I should just use Web Browser.  I'm aware of web browser control but I was hoping to find something more powerful.
0
 
Dave_GreeneCommented:
What do you want to do with the PDF's?  and other files for that matter?
0
 
WizeOneAuthor Commented:
All I want to do is view the documents.  This functionality is not to allow 'editing'.
0
 
Dave_GreeneCommented:
You may be able to use (not sure about redistribute) the Adobe Acrobat OCX

Object = "{CA8A9783-280D-11CF-A24D-444553540000}#1.3#0"; "pdf.ocx"'

This would be the most powerful!
0
 
WizeOneAuthor Commented:
Interesting point.  I wasn't aware of this ocx.  I'm sure redistribution isn't a problem, as long as the user a Acrobat installed on their PC...but the control is not supported by Adobe Acrobat.

In looking up about the control, it was built to integrate with Windows Explorer.

So maybe this control combined with disable some of the functionality of WebBrowser is my answer.
0
 
Dave_GreeneCommented:
Good point, keep me posted
0
 
ArkCommented:
Just place WebBrowser control on form.
WebBrowser1.Navigate CommonDialog1.FileName

Cheers
0
 
WizeOneAuthor Commented:
Ark,
I'm aware of the WebBrowser control... the down side is I would need to disable some of the uses within WebBrowser.  For example, the documents are for viewing, so I would need to disable editing capabilities along with the menu bar, and the right mouse click.  

I was hoping to find something a little more powerful, but I'm finding that so far there is nothing else to use...
0
 
WizeOneAuthor Commented:
I've now concluded (after working in-between several projects) that WebBrowser control is currently the most capable container to support what I'm looking to do. (see original question).

My difficulty now is... How can I disable the editing a word, excel, etc. document within the WebBrowser?  I only want to view/scroll the document and not allow for the ruler bar to show, change the text, etc.

The same is true for the right mouse click event, how can I turn this off?  
0
 
ArkCommented:
Try
WebBrowser1_DownloadComplete(..)
   On Error Resume Next
   WebBrowser1.Document.ReadOnly = True

Cheers
0
 
WizeOneAuthor Commented:
Ark,
Thank you for your code, but I'm getting the following results:

Error Number: 438
Description: Object doesn't support this property or method

Any thoughts?
0
 
jdmcclanahanCommented:
If you try setting the ReadOnly property for an OLE container with a Word document, you get the error that the property is read only.  I assume its also true for the Web Browser control.
0
 
DanRollinsCommented:
Hi WizeOne,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Ark's comment(s) as an answer.

WizeOne, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
WizeOneAuthor Commented:
Hello DanRollins,

I haven't forgotten the question.  The project I was working on for needing this question has been canceled.  A few months later my employer was hit by the economy down fall and let a few of us go...including me.  

At the moment I'm unemployed in the technical world but for my own resources I'm still looking for an answer.  Ark's answer was one that I was aware of but not what I'm looking for.  

For now, mabye we should just remove the question.
0
 
Computer101Commented:
Points reduced to 0 and placed in PAQ

Computer101
E-E Moderator
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 10
  • 7
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now