Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: BruceTOGAF2 on October 25, 2017, 02:23:06 am
-
I already posted 'Method LoadLinkedDocument' which shows how I paste the content of a spreadsheet cell into a Linked Document.
This post is to enquire about Jscript getting the contents of the Windows Clipboard.
I would like to manually highlight some text in a MS-Word document and copy (Ctrl-C) the highlighted text into the Windows Clipboard, then run a Sparx Jscript that
- copies the content of the Windows Clipboard into a string var called Clipboard_Text
- creates a docGenerator document i.e. docGenerator.NewDocument("");
- pastes the string Clipboard_Text into the docGenerator document i.e. docGenerator.InsertText(Clipboard_Text, "Normal");
- saves the docGenerator document as an RTF file i.e. docGenerator.SaveDocument( "myTempDocument.rtf", dtRTF);
- Creates new artefact document i.e. artifElement = myElements.AddNew( artifName, "Artifact"); artifElement.Stereotype = "Document";
- Attaches the linked document to Artifact element i.e. var myDoc = artifElement.LoadLinkedDocument("myTempDocument.rtf");
Can a Sparx Jscript get access to the content of the Windows Clipboard?
-
I'm not sure about the clipboard.
Most solutions I found included an ugly workaround using Internet Explorer (of all things)
But have you tried getting the contents from the Word API directly?
That way you wouldn't have to hijack the clipboard. I hate it when applications put something on the clipboard and overwrite whatever I had copied.
Geert
-
I do not know about Word API. I typed 'Word API' into the Sparx Enterprise Architect User Guide and got zero search results. Please can you pint to me a useful resource about Word API.
-
Google is your friend here, not Sparx' search engine. http://lmgtfy.com/?q=microsoft+word+api (http://lmgtfy.com/?q=microsoft+word+api)
q.