The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Help needed - Export GraphPage as OLE object

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hajo Posted - 03/03/2005 : 11:39:10 AM
Origin Version (Select Help-->About Origin): 7.5ProSR5
Operating System:WinXP

Hello, All

I want to export some GraphPages as OLE objects to e.g. Powerpoint (like CNTR+J) using OriginC

Is there any code available or can anybody post some, so I can get some impression how to do that.

(I want to avoid to export to bitmap first and then to imort the bitmap to the target application ...)

Thanks for your help
Hajo

--
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive,
Regensburg, Germany
9   L A T E S T    R E P L I E S    (Newest First)
hajo Posted - 03/10/2005 : 2:49:00 PM
Hello, All

does anybody now, when MS introduced the PasteSpecial() function to Powerpoint.

There are problems for MS PPT 2000 I know of, PPT-2003 is working fine ... But what about the versions between ....

Thanks
Hajo

--
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive,
Regensburg, Germany
ML Posted - 03/06/2005 : 6:13:45 PM
It's been tracked as 7466.

ML
hajo Posted - 03/05/2005 : 08:17:58 AM
Hello, ML

don't forget the LayoutPage ....

Thanks
Hajo

--
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive,
Regensburg, Germany
ML Posted - 03/04/2005 : 5:12:32 PM
We will try to add a friendly "CopyPage()" method to GraphPage class in the future.

Thanks.

ML
hajo Posted - 03/04/2005 : 3:12:49 PM
Thanks ML for the code...

It looks quite similar to my PPT code (The compile error is bacause of the page constant to import - "ppLayoutBlank" - don't know the numeric value, might be 0 - am I right?)

Is there a possibility to do something similar in OriginC like the LabTalk call "clipboard pageName"?

I think that would be a feature for further versions to have a real OriginC function to copy the OLE object to clipboard directly without using the "fallback" to LabTalk ...

So far
Hajo

--
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive,
Regensburg, Germany
ML Posted - 03/04/2005 : 11:42:56 AM
Hi Hajo,

Here is how it can be done by only executing Copy via a LT call:


void test_copying_multiple_graps_and_pasting_to_Excel()
{
Object oExcel, oworkbooks, oworkbook, oworksheet, oRange;
GraphPage gp;


oExcel = CreateObject("Excel.Application");
oExcel.Visible = true;

oworkbooks = oExcel.Workbooks;

oworkbook = oworkbooks.Add();

oworksheet = oworkbook.ActiveSheet;

int ii = 0;

foreach(gp in Project.GraphPages)
{
string strName = gp.GetName();
out_str(strName);

BOOL bShown = gp.Show;
if (!bShown)
gp.Show = TRUE;
string strLtcmd = "clipboard " + strName;
gp.LT_execute(strLtcmd);
if (!bShown)
gp.Show = FALSE;

string strRange;
char chCol = 'A' + ii;
strRange.Format("$%c$%d", chCol, ii + 1);
oRange = oworksheet.Range(strRange);
oRange.PasteSpecial();

ii += 3;
}
}


In the function I paste into Excel, as I could not get your PowerPoint code to compile.

Note the call to show a window if hidden in order to successfully copy.


ML
hajo Posted - 03/04/2005 : 05:08:43 AM
hello, all

here's the code I use as base for my functionality ...
+ some comments & questions ...

void exportOLEApp(int appType = TARGET_APP_MSPPT)
{
Object ppApp, ppPres, ppSlide, ppShape;
string strGpName, strLtcmd;

ppApp = CreateObject("PowerPoint.Application");
ppApp.Visible = true; // zunaechst verdeckt oeffnen; erst nach dem vollstaendigen
// Einfuegen der Bilder sichtbar machen
ppPres = ppApp.Presentations.Add(true);
//ppPres = ppApp.Presentations.Open(template, true);
if(OpenClipboard(NULL))
{
EmptyClipboard();
CloseClipboard();
}

foreach(GraphPage gp in Project.GraphPages)
{
strGpName = gp.GetName();
set_active_layer(gp.Layers());

if(page_active_layer_index(gp)!=-1)
{
strLtcmd = "clipboard "+strGpName;
gp.LT_execute(strLtcmd);

ppSlide = ppPres.Slides.Add((ppPres.Slides.Count + 1),ppLayoutBlank);
ppShape = ppSlide.Shapes.PasteSpecial();
}
else
printf("Page: %s was not active!!\n", strGpName);
}
}


Copying from Origin to an other application using the clipboard is more tricky I expected!

1) in the foreach loop I have to activate each GraphPage seperately by the call "set_active_layer(gp.Layers())". I had expected that by looping through the Collection for getting the GraphPage is enough ...
2) The call gp.LT_execute("LTCODE") doesn't activate, as documented in the help, the calling page (gp) and restores the former activated page ....

3) How can I do the same using OriginC only?

Please comment ...
So far
Hajo


--
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive,
Regensburg, Germany


Edited by - hajo on 03/04/2005 05:09:56 AM

Edited by - hajo on 03/04/2005 05:11:07 AM
hajo Posted - 03/04/2005 : 02:57:23 AM
Hello, Easwar

thanks for the hint.
I'll look into that and report ...

So far
Hajo

--
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive,
Regensburg, Germany
easwar Posted - 03/03/2005 : 12:06:12 PM
Hi Hajo,

1> If you are running Origin as the client and Power Point as server application (possible with COM Client programming if you have OriginPro), then you can use the LabTalk command
clipboard winname
to first copy the graph page to clipboard, and then issue the appropriate command to the server application to paste the data as either static picture or as OLE embedded object, which is equivalent to the options under the paste special menu - you will need to look up the PowerPoint command on how to do this.

2> If you are running Origin as server and Power Point as client application, you can use the method:
originObject.CopyPage()
to get the page into clipboard and then follow up with necessary code to paste in the client application.
For example, in Excel, once the graph has been copied to clipboard in Origin, it can be OLE-pasted to a particular cell location using VB code such as:

Set rng = range("a23:a23")
rng.PasteSpecial


Easwar
OriginLab



Edited by - easwar on 03/03/2005 12:52:20 PM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000