Author Topic: Method LoadLinkedDocument and Windows Clipboard  (Read 153 times)

BruceTOGAF2

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Method LoadLinkedDocument and Windows Clipboard
« 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?


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7671
  • Karma: +156/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Method LoadLinkedDocument and Windows Clipboard
« Reply #1 on: October 25, 2017, 04:25:42 pm »
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

BruceTOGAF2

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Method LoadLinkedDocument and Windows Clipboard
« Reply #2 on: October 31, 2017, 07:40:57 pm »
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.

qwerty

  • EA Guru
  • *****
  • Posts: 8895
  • Karma: +134/-122
  • I'm no guru at all
    • View Profile
Re: Method LoadLinkedDocument and Windows Clipboard
« Reply #3 on: October 31, 2017, 10:18:33 pm »
Google is your friend here, not Sparx' search engine. http://lmgtfy.com/?q=microsoft+word+api

q.
« Last Edit: October 31, 2017, 10:20:12 pm by qwerty »