ActiveX or OLE for WINWORD?
ActiveX or OLE for WINWORD?
I would like to start using WINWORD from FWH.
Do I have to use ActiveX or OLE?
Which libs do I have to include to use ActiveX from Harbour?
Thanks in advance
Otto
Do I have to use ActiveX or OLE?
Which libs do I have to include to use ActiveX from Harbour?
Thanks in advance
Otto
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: ActiveX or OLE for WINWORD?
OLE if you just want to use Word as an external application. ActiveX if you want to use Word as an embedded application.Otto wrote:I would like to start using WINWORD from FWH.
Do I have to use ActiveX or OLE?
Harbour? hbole.lib, I think.Otto wrote:Which libs do I have to include to use ActiveX from Harbour?
EMG
Ole for Winword
Hello Otto,
For Winword, You can use AutoOle, same like in Excel.
I look in my archiv, to find some samples for you.
Regards
Uwe
For Winword, You can use AutoOle, same like in Excel.
I look in my archiv, to find some samples for you.
Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Hello Enrico,
Thank you for your help. Now I tried the word.prg-sample from the FIVEWIN examples.
I linked HBOLE.LIB (my lib is from 2004).
But I get a Harbour exception error.
Maybe you can give me some more help.
Regards e Buona pasqua,
Otto
Thank you for your help. Now I tried the word.prg-sample from the FIVEWIN examples.
I linked HBOLE.LIB (my lib is from 2004).
But I get a Harbour exception error.
Maybe you can give me some more help.
Regards e Buona pasqua,
Otto
Code: Select all
// Using Microsoft Office Word ActiveX
#include "FiveWin.ch"
function Main()
local oWnd, oActiveX, cString
DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"
if IsActivex( "Word.Application.8" )
cString := "Word.Application.8"
endif
if IsActivex( "Word.Application.9" )
cString := "Word.Application.9"
endif
if IsActivex( "Word.Application.10" )
cString := "Word.Application.10"
endif
if IsActivex( "Word.Application.11" )
cString := "Word.Application.11"
endif
if IsActivex( "Word.Application.12" )
cString := "Word.Application.12"
endif
oActiveX = TActiveX():New( oWnd, cString )
oWnd:oClient = oActiveX // To fill the entire window surface
ACTIVATE WINDOW oWnd
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Otto,
I guess you are testing Word 2007. It also GPFs here. It seems there is a conflict between Class TActiveX and Word 2007.
We are googling for some info about it, and we have found that VB users are also having troubles:
http://www.google.es/search?hl=es&q=%22 ... 2007&meta=
http://www.google.com/search?hl=en&q=%2 ... tion.12%22
I guess you are testing Word 2007. It also GPFs here. It seems there is a conflict between Class TActiveX and Word 2007.
We are googling for some info about it, and we have found that VB users are also having troubles:
http://www.google.es/search?hl=es&q=%22 ... 2007&meta=
http://www.google.com/search?hl=en&q=%2 ... tion.12%22
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- xProgrammer
- Posts: 464
- Joined: Tue May 16, 2006 7:47 am
- Location: Australia
Hi Otto
Not sure what you want to do with Word so hard to make recommendations. If you tell us a bit more about what you want to achieve we can possibly help more.
I used Word from FiveWin code a number of times and it worked well. (I got off the Microsoft gravy train so I don't have 2007 so can't test that.)
Amongst the things I did:
FiveWin program to control word to open and convert many thousands of Word documents to straight text format so that I could do data mining on them.
FiveWin program to draft up medical reports for editing etc by doctors
FiveWin code producing reports as Word documents.
Speed was very pleasing (I didn't expect that).
For producing reports I wrote a basic class (MLETTER) to handle all the Word details in one place.
Basic code looks like:
AS you can see the first insert is a little different (InsertAfter seems to fail with a document with no contents, but from then on its plain sailing. As you go you can add refinements, eg
By the way if you just want to produce documents that Word can subsequently handle why not consider switching to the XML based standard (which Word now grudgingly supports I believe) in which case no special programming is required. I am now doing that, although I do want to write some code to control OpenOffice from a FiveLinux application (on a LInux platform)
I hope that may be of some help.
I can't guarantee that the code is 100% correct as I had to retype it and change it a bit as I went so it wasn't confused by my particular needs.
Regards
Doug
(xProgrammer)
Not sure what you want to do with Word so hard to make recommendations. If you tell us a bit more about what you want to achieve we can possibly help more.
I used Word from FiveWin code a number of times and it worked well. (I got off the Microsoft gravy train so I don't have 2007 so can't test that.)
Amongst the things I did:
FiveWin program to control word to open and convert many thousands of Word documents to straight text format so that I could do data mining on them.
FiveWin program to draft up medical reports for editing etc by doctors
FiveWin code producing reports as Word documents.
Speed was very pleasing (I didn't expect that).
For producing reports I wrote a basic class (MLETTER) to handle all the Word details in one place.
Basic code looks like:
Code: Select all
::oWord := CREATEOBJECT( "Word.Application" )
::oWord:Visible := .T. // if you want to see it
::oDocument := oWord:Documents:Add()
::oDocument:SaveAs( sFileName, WdFormatDocument ) // WdFormatDocument is a defined constant
::oRange := ::oDocument:Range( 0, 0 )
::oRange:InsertBefore( sDateAsText )
::oRange:ParagraphFormat:Alignment := WdAlignParagraphRight //WdAlignParagraphRight is a defined constant
::oRange:InsertParagraphAfter()
::iEnd := ::oRange:End
::oRange := ::oDocument:Range( ::iEnd, ::iEnd )
::oRange:InsertAfter( sGreeting )
::oRange:ParagraphFormat:Alignment := WdAlignParagraphLeft //WdAlignParagraphLeft is a defined constant
::oRange:InsertParagraphAfter()
::iEnd := ::oRange:End
Code: Select all
::oRange:Bold := .T.
::oRange:FontName := "Arial"
I hope that may be of some help.
I can't guarantee that the code is 100% correct as I had to retype it and change it a bit as I went so it wasn't confused by my particular needs.
Regards
Doug
(xProgrammer)