Thanks Wendy,
I tried using Word_TablesAdd so I could pass VARIANTs for table behaviour and autofit behaviour as follows
Word_GetProperty (docHandle, NULL, Word_DocumentApplication,CAVT_OBJHANDLE, &appHandleL);
Word_GetProperty (appHandleL, NULL, Word_ApplicationSelection,CAVT_OBJHANDLE, &currSelHandleL);
Word_GetProperty (currSelHandleL, NULL, Word_SelectionRange,CAVT_OBJHANDLE, &rangeHandleL);
Word_GetProperty (docHandle, NULL, Word_DocumentTables,CAVT_OBJHANDLE, &tablesHandleL);
tblbehav = CA_VariantInt (WordConst_wdWord8TableBehavior); // tried both of these
;tblbehav = CA_VariantInt (WordConst_wdWord9TableBehavior); // but neither helped
afbehav = CA_VariantInt (WordConst_wdAutoFitFixed); // didn't try the other 2 options for this VARIANT
// Add a table with 1 row x 3 columns
Word_TablesAdd (tablesHandleL, NULL, rangeHandleL, 1, 3, tblbehav, afbehav, &tableHandle);
WordRpt_GoToLineAfterTable (tableHandle);
// Put 1st graph into 1st cell of table
WordRpt_GoToCell (tableHandle, 1, 1);
InsertGraph (REPPANEL_GRAPH1,1);
// Put 2nd graph into 2nd cell of table
WordRpt_GoToNextCell (tableHandle);
InsertGraph (REPPANEL_GRAPH2,2);
etc.
void InsertGraph (int graphcontrol, char graphnum)
{
char imageFileName[MAX_PATHNAME_LEN];
char filename[15];
CAObjHandle imageHandle;
// Create a temporary file to hold bitmap to be loaded into report
GetProjectDir (imageFileName);
sprintf(filename, "\\rpt%d.bmp",graphnum);
strcat (imageFileName, filename);
SaveCtrlDisplayToFile (reppanel, graphcontrol, 1, -1, -1, imageFileName);
WordRpt_InsertImage (docHandle, imageFileName, &imageHandle);
CA_DiscardObjHandle (imageHandle);
Delay(0.2);
// Delete the temporary file else Windows loads the same image into all cells of table
DeleteFile (imageFileName);
}
Result: still ok for Word2000 but no better than before for Word2003
Next I tried using an existing Word doc with fixed size tables already in it (fixed row & column sizes)
and I put bookmarks in each cell and used go to bookmark and insert the bitmap
This was better but only some of the graphs ended up in the right place.
Also Word2003 produced the following error message in this case...
Error
The graphics filter was unable to convert this file
C:\Program files\...\office11\MS WORD.OLB
I read that for compatibility between word2000, 2002, 2003 you should not use OLB files and you should use late binding instead of early binding. I read that this means that instead of compiling fixed Objects, you declare variable Objects. Then when the program runs it assigns the actual type of object to that variable ??
I got real lost at this point.
Does CVI word2000 demo use early binding?
Can anyone explain how to use late binding with CVI.
Regards,
Ewen