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