Hello everyone
I have read some discussions on this forum but i didn't find solution.
I need to take long text from clipboard into variables.
I read on this forum about this OCX:
http://www.mibuso.com/dlinfo.asp?FileID=149
and I tried to use it but it work fine only when the text length in clipboard is less than 255 characters.
(I would split the clipboard text to couples text variables or use one text variable with couples dimensions - that’s not a problem)
Example:
Code below works fine where in my clipboard contain text till 254 characters.
i := STRLEN(Clipboard.TextFromClipboard);
If I copy to clipboard 255 characters (or more) the line above gives an error:
The length of the text string exceeds the size of the string buffer.
Thanks for any suggestion. Maybe I could you some different OCX /solution ?
Answers
I've had similar problem and solved it using Excel and Excel Buffer.
This is a simple code skeleton:
There are certain problems with this approach, if your text in clipboard includes tabs pasted text will be spread among columns, if your text in clipboard includes new lines pasted text will be spread across some rows.
But at least it is a starting point.
NB: XL* variables are copied from Excle Buffer table.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
That’s quite clever solution of this topic but as you mention, there are some disadvantages of such approach.
As I think, to use this solution, client has to have Excel installed on local computer. In my case, Excel can’t be installed (for some reasons).
I will think more how to “adjust” your idea. Thanks once again.
BTW.
It could be added one more line:
XlApp.DisplayAlerts(FALSE);
before closing workbook. That will hide Excel question window if you want to save workbook.
Any other ideas ?
Piotr
I'd rather try to stay away from 3rd party OCX or dlls as they also needs to be installed on client's PC, and that's often harder to get installed than the Excel.
Another idea? What about writting your own small DLL reading from and/or writting to clipboard? There are a few templates around of dlls which can be seen by Classic Client.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Thank you Sławek.
Clipboard msdn
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Yeah, makes sense