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
 How to clip one more graph to the word?

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
70WorkRoom Posted - 07/16/2007 : 09:53:59 AM
Origin Version (Select Help-->About Origin): Origin pro v7.5
Operating System:windows 2000

When I write the code as follow,i can only clip one graph to the word,and i must make a table first to Insert some strings to the word.
How can i clip more graph to the one word file,and insert strings to the word without table template?

 
void pasting_to_Word(string strGraph,string strContent,string strFileName)
{
Object oWord, oWordDoc;
// Need to point to active page and check validity?

GraphPage gp = Project.Pages(strGraph);
if( !gp ) return;

oWord = CreateObject("Word.Application");
oWord.Visible = false;
// neues Word-Dokument erstellen
string strFldPath = GetFilePath(__FILE__);
oWordDoc = oWord.Documents.Add(Template := strFldPath + "Template.doc");

oWordDoc.Tables(1).Cell(Row := 1, Column := 1).Range.InsertAfter(Text := strContent);

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;

// Selection referes to where the cursor is located,
// and that is Word Application property, not Word Doc property
oWord.Selection.Range.PasteSpecial(DataType:=wdPasteOLEObject );
oWordDoc.SaveAs(FileName := "C:\\" + strFileName + ".doc");
oWordDoc.Quit();
// Need to resize table cell....need to look that up...
}
1   L A T E S T    R E P L I E S    (Newest First)
joseph_king Posted - 07/19/2007 : 03:40:18 AM
Hi 70WorkRoom,
Could you try using the following code? The following sample show how to clip 2 graphs to the one word file and solve your problem.


void pasting_to_Word(string strGraph1,string strGraph2, string strContent,string strFileName)
{

Object oWord, oWordDoc;

// Need to point to active page and check validity?


oWord = CreateObject("Word.Application");

oWord.Visible = false;

// neues Word-Dokument erstellen

string strFldPath = GetFilePath(__FILE__);

/************* you don't need to apply a template *******************/
//oWordDoc = oWord.Documents.Add(Template := strFldPath + "Template.doc");
//oWordDoc.Tables(1).Cell(Row := 1, Column := 1).Range.InsertAfter(Text := strContent);

oWordDoc = oWord.Documents.Add();
oWord.Selection.TypeText(strContent);
oWord.Selection.TypeParagraph();
/***************************** end *********************************/


GraphPage gp = Project.Pages(strGraph1);
if( !gp ) return;

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;

// Selection referes to where the cursor is located,
// and that is Word Application property, not Word Doc property
oWord.Selection.Paste();


/******************Copy the second graph**********************/
gp = Project.Pages(strGraph2);
strName = gp.GetName();
out_str(strName);
bShown = gp.Show;

if (!bShown)
gp.Show = TRUE;

strLtcmd = "clipboard " + strName;
gp.LT_execute(strLtcmd);
oWord.Selection.Paste();
/************************* end *****************************/


oWordDoc.SaveAs(FileName := "C:\\" + strFileName + ".doc");
oWord.Quit();
// Need to resize table cell....need to look that up...
}


Joeseph King
OriginLab Technical Services

Edited by - joseph_king on 07/19/2007 03:51:39 AM

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