Paste working using c# code

Hi,
I had just started to use Libre.
I want to paste contains of clipboard in "Calc" using c#.net code
I tried using XSheetPastable but I am not getting any example for using
XSheetPastable.

Can some body help me how the code should be?

Thanks in advance for your Help.
From
Vighnahar Mone

Hi :slight_smile:
Sorry no-one has been able to reply so far! I think the Devs mailing list
or irc (or whatever) channel might be more useful!
Regards from
Tom :slight_smile:

The easiest way (but not the most beautiful way) to do it seems to be:

         private void button1_Click(object sender, EventArgs e)
         {
             var prc = Process.GetProcessesByName("soffice.bin");
             if (prc.Length > 0)
             {
                 SetForegroundWindow(prc[0].MainWindowHandle);
                 SendKeys.Send("{F5}^AB{TAB}2{ENTER}abc{ENTER}{F5}");
             }
         }

This code puts the text "abc" i field "B2"

more info here:
https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send(v=vs.110).aspx

If you study how to use any UNO interface then you know how to use
XSheetPastable as well.

XSheetPastable is marked as depricated and I can not find any object
supporting this interface.

Andreas Säger wrote:

> >
> >
> > If you study how to use any UNO interface then you know how to use
> > XSheetPastable as well.
> >
> >
> >
>
> XSheetPastable is marked as depricated and I can not find any object
> supporting this interface.
>
XSheetPastable is nowhere implemented. So not only is it deprecated, it is also useless. It would be better if it were removed.

Andreas Säger wrote:

> >
> >
> > If you study how to use any UNO interface then you know how to use
> > XSheetPastable as well.
> >
> >
> >
>
> XSheetPastable is marked as depricated and I can not find any object
> supporting this interface.
>
XSheetPastable is nowhere implemented. So not only is it deprecated, it is also useless. It would be better if it were removed.

Well, it should be implemented because we have no equivalent. It is easy
enough to copy within the same document using interface
XCellRangeMovement. However, if you want to copy between documents or if
you want to paste arbitrary clipboard content, you need to use the
respective dispatch command, transfer data arrays, formula arrays or
create a sheet link and then release the sheet link.

@vighnahar.mone@upcrest.com
If macros are your "natural" way to handle spreadsheets, if xls(x) is
your file format and .NET/C# is your preferred environment, then you
should definitively stick with MS Excel and nothing but MS Excel.

If you would tell us what exactly you are going to copy from where, I
may know a fairly workable method.
This mailing list is very poor when it comes to more advanced questions.
You get better support on

https://forum.openoffice.org/en/forum/index.php

Hope this helps,
Andreas Säger