|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| [WD19] Problem running MS Office automation on Mac/Parallels |
| Iniciado por guest, 08,dic. 2014 06:28 - 7 respuestas |
| |
| | | |
|
| |
| Publicado el 08,diciembre 2014 - 06:28 |
Hello All
I fully appreciate that I am asking for the highly unlikely and possibly the impossible, but it is Christmas.
I have a qaulity management system written in Windev and I have been asked to trial it on a Mac running parallels with Windows8. I started with zero expectations so I was surprised that the software worked fine and quite impressed when double clicking on a document name in a table opened the document in the Mac copy of MS Word (using shell execute). The problem is that the office automation doesn't work. The software has a master set of documents that are copied into each job and then modifed to suit that job. As the documents are copied, a find and replace routine is run and this fails after GetActiveObject() This is the code //Find and replace in a word document MyWordObject is object OLE dynamic IF MyWordObject <> Null THEN MyWordObject>>Visible = OLETrue MyWordObject>>Quit() END MyWordObject=GetActiveObject("Word.Application") IF MyWordObject=Null THEN // check if word is open WHEN EXCEPTION IN MyWordObject = new object OLE "Word.Application" DO Info("MS Word is not installed on this computer. The find and replace function cannot complete") LOkToFindReplace = False delete MyWordObject END //exception The other complication is that I do not have a Mac or access to one and the client is 800 miles away so contact with them is via teamviewer. It may be a simple as finding the name of the "Word" OLE server application that is on offer from the Mac I suppose onother solution may be to purchase another copy of MS Word and run it in the parallels partition ?
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 08:51 |
Word works also with the RTF-format, as does Wordpad (so, you have two different tools without buying another copy of MS-Office). On Mac TextEdit works native with RTF too.
Of course they lack a lot of automation tools, but the big advantage of working with the RTF-format is ... you work with files ... and in files you can find, replace, anything you want, without using automation-tools.
The fun thing ... if you name the extension of the resulting document .doc or .docx ... then the RTF-document opens in Word when you use shellexecute or doubleclik.
If anything else fails ... this might be a trail to try, Kind regards, Rudolf |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 11:33 |
Hello Al
I do not think that what you want to do is directly achievable...
However, there is some good news... I recently did some work for a customer on a .net assembly called gembox. This tools allows you to do all kind of search and replace in a word document WITHOUT needing office installed. It is useful mostly on web servers, but should work the same way in your parallel situation.
Also, my customer plans to publish some wlanguage example code as soon as he has the time, as the first implementation was kind of painful (hence my participation)...
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 11:47 |
Hello Fabrice
Thanks for the information. I am in touch with Parallels Tech support but I am not hopeful of them coming up with a solution because there are no registry entries to provide an OLE server for MS Word.
The gembox product might also be able to solve a few other problems I am having with the Windev PDF generator.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 13:00 |
Al Stab in the dark here as I am just starting with a Mac/Parallels setup and have to say that so far I have found it to be pretty good as a WD development platform.
I have not needed to do what you are after but what I did find is that, assuming your client is using Word for Mac is that documents are saved by default as .docx....... The default, XML-based document format for Word 2008 for Mac, Word for Mac 2011, Word 2007 for Windows, and Microsoft Word 2010 for Windows..
Searching for OLE in the help returns nothing so possible has not been implemented in the Mac version. Your option to install a Windows version on the virtual machine would however be a solution - I have Office 2007 working on mine without issues. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 13:48 |
Hello Derek
Thanks for confirming that. It does look like another copy of Word would provide an imediate solution, with the .net gembox package an option to be explored if some code becomes available as a starting point.
You are right though, parallels is quite impressive, I was amazed to see it open documents using the Mac version of MS Word from a shellexecute() (using associations) that was initiated from the Windev application running inside parallels.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 19:14 |
Al Had a few minutes to spare so thought I would have a rummage around. Seems that 'AppleScript' is your friend - now I use the word 'friend' here very loosely as... a. It seems that apple scripting is a bone fide skill set in its own right.:confused: b. You will need a Mac to be able to write and save the scripts.:sneg: c. Scripts written for Office for Mac 2008 may not work on Office for Mac 2011.<img src="/NG2013_WEB/ui/smiley/2.gif" align=absmiddle border=0 alt=":-(">
On a positive note the following script (I copied it) does work from WD running on a Parallels 10 VM calling Word for Mac 2011 running on OSX 10.10 Yosemite. set outputPath to (path to home folder as string) & "toto.doc" tell application "Microsoft Word" activate make new document set theDate to ((current date) as string) tell active document set theRange to create range start 0 end 0 set content of theRange to theDate end tell set activeDoc to active document save as activeDoc file name outputPath end tell Quite a number of examples if you google 'applescript find and replace word 2011'
Should you become a 'guru' in this area please let me know as I may need your skills in the future.:xcool: |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 20:06 |
Hello Derek
Gee whiz, so many choices, learn Apple Script, learn .Net to Windev integration, poke myself repeatedly with a sharp stick ..
Thanks for looking into it further. I think the gembox route holds the most promise for me because its toolbox approach might be easier to learn and it holds out the promise of more functionality that I can use plus I think the sky will fall in if I buy a Mac.
I am more than happy to share whatever comes out of the gembox work though.
Regards Al |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|