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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to add Origin graph to MS Word file?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hkkim

Republic of Korea
35 Posts

Posted - 09/17/2012 :  04:02:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8.1 SR3
Operating System: Windows XP

I'm a novice in Origin C. I want to make an automation of many graph generation using LabTalk and Origin C. At first I wanted to make this work with LabTalk only. But there are so many graphs that
I want to divide them into several MS Word files. I attached the modifed sample program,
\\Samples\COM Clients\MS Office\ReportCreation.c below. The CreateReportDoc() will be called several times. I want to add all graphs(excluding embedded graphs) in my current Origin project to a MS Word file. I don't know the exact command to add a graph(**) and skip a embedded graph(*). Could you show me the way ?

---------------------------------------------------------------------
void CreateReportDoc()
{
// Create a Word application object and set as invisible
Object oWord, oWordDoc;
oWord = CreateObject("word.application");
//oWord.Visible = false;
oWord.Visible = true;

// Loop over all graphs in project
foreach(GraphPage grPg in Project.GraphPages)
{
//* Skip over any embedded graphs or Layout windows
// LabTalk scripts: if(page.IsEmbedded==0&&exist(%H)!=11)
// <== How to add here?
out_str(grPg.GetName()); // output graph name

// Add a new document to the Word application
oWordDoc = oWord.Documents.Add();

// Insert graph into Word document
// ** how to add graph to MS Word file
oWordDoc.Add(grPg); // <== How to fix here?
}

// Save the Word document
string strFldPath="D:\Study\Test\RunTest";
oWordDoc.SaveAs(FileName := strFldPath + "CreateReport" + ".doc");
printf("Report saved as %s\n",strFldPath + "CreateReport" + ".doc");

// Close the Word applications
oWord.Quit();
printf("Done!\n");
}

Penn

China
644 Posts

Posted - 09/18/2012 :  01:47:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

As you can see the example provided by Origin (ReportCreation.c), the graph in Origin will be exported as image of bmp format, and then add to Word. Maybe you can try this method first.

About skipping the embedded graph, please refer to GetEmbeddingInfo method.

Penn
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000