Hello again,
In my VO app I have used Wordbasic to generate some simple reports for the user in a new Word doc.
I would like to provide the same functionality in my X# application when converted, but can't figure out how to include the Wordbasic library in my project, and then reference it.
I found some docs from MS regarding C#, but 2 days trying to figure this out is making me crazy.
https://docs.microsoft.com/en-us/dotnet ... erty-value
Can anyone please list the steps involved in getting Wordbasic into the X# app and using it?
Maybe there is a better / different way...
In VO I declare it in the window class where I want it: PROTECT oWord AS wordbasic
And then simple stuff in the method.
SELF:oWord:=Wordbasic{}
IF !SELF:oWord:fInit
WarningBox{SELF,"Can't start MS-Word!","If Word is installed on this computer try opening it manually and try again."}:show()
RETURN NIL
ENDIF
SELF:oWord:FileNewDefault()
SELF:oWord:AppShow()
...<etc...>
Thanks!
Jonathan
Using wordbasic in X# / VO application
Using wordbasic in X# / VO application
Hi Jonathan,
the MS documentation says there is an assembly Microsoft.Office.Interop.Word.dll - you need to include that and add a "using Microsoft.Office.Interop.Word" on the top of your prg file.
I have that DLL file here (Office 2010):
c:WindowsassemblyGAC_MSILMicrosoft.Office.Interop.Word14.0.0.0__71e9bce111e9429cMicrosoft.Office.Interop.Word.dll
Wolfgang
the MS documentation says there is an assembly Microsoft.Office.Interop.Word.dll - you need to include that and add a "using Microsoft.Office.Interop.Word" on the top of your prg file.
I have that DLL file here (Office 2010):
c:WindowsassemblyGAC_MSILMicrosoft.Office.Interop.Word14.0.0.0__71e9bce111e9429cMicrosoft.Office.Interop.Word.dll
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Using wordbasic in X# / VO application
Jonathan,
- Add a reference to the MsWord type library (see our example that covers Excel : https://www.xsharp.eu/help/example-4-ol ... ation.html )
- add a using statement for word: USING Microsoft.Office.Interop.Word
- create an object of the word application: oWord :=ApplicationClass{}
- don't use oWord:Finit, that is what we did with OleAutomation. If word can't be started you will get a normal .Net exception
Robert
- Add a reference to the MsWord type library (see our example that covers Excel : https://www.xsharp.eu/help/example-4-ol ... ation.html )
- add a using statement for word: USING Microsoft.Office.Interop.Word
- create an object of the word application: oWord :=ApplicationClass{}
- don't use oWord:Finit, that is what we did with OleAutomation. If word can't be started you will get a normal .Net exception
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Using wordbasic in X# / VO application
Thank you Robert and Wolfgang, very helpful! I have found the other MS dll files that can also be referenced so will try to build those in too!
One more question, if I may:
I have a lot of errors: XS0102: The type 'XXXXXX' already contains a definition for 'XYZ'
BUT, I have only declared these variables in the one place.
What is it I need to find / fix to cure this error?
One more question, if I may:
I have a lot of errors: XS0102: The type 'XXXXXX' already contains a definition for 'XYZ'
BUT, I have only declared these variables in the one place.
What is it I need to find / fix to cure this error?
Using wordbasic in X# / VO application
Jonathan,
Robert
Give us more info ?Jonathan Neil wrote: One more question, if I may:
I have a lot of errors: XS0102: The type 'XXXXXX' already contains a definition for 'XYZ'
BUT, I have only declared these variables in the one place.
What is it I need to find / fix to cure this error?
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Using wordbasic in X# / VO application
sorry.
In VO I have declared the variables in the class as INSTANCE or PROTECT, or they are Access/Assign variables.
Not all variables.
Looking at it right now, it looks like in X#, because several classes have been gathered up into .prg files, if each class had an instance of that variable, it was not a problem in VO, but in X# they are visible to each other... I need to go and check if that is the reason.
Thanks again.
In VO I have declared the variables in the class as INSTANCE or PROTECT, or they are Access/Assign variables.
Not all variables.
Looking at it right now, it looks like in X#, because several classes have been gathered up into .prg files, if each class had an instance of that variable, it was not a problem in VO, but in X# they are visible to each other... I need to go and check if that is the reason.
Thanks again.
Using wordbasic in X# / VO application
Hi Jonathan,
Please install the newest X# build (from today!), including the new XIDE and then re-export your code with the new VOXporter, it should take care of this as well (it will remove the INSTANCE variables)
Please install the newest X# build (from today!), including the new XIDE and then re-export your code with the new VOXporter, it should take care of this as well (it will remove the INSTANCE variables)
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu