View Single Post
  #3   Report Post  
Posted to microsoft.public.word.tables
Benny
 
Posts: n/a
Default can anybody help me in using the function "converttotable"

Thank you macropod,
I have also set the other parameters:
NumRows = 8 NumColumns = 9 InitialColumnWidth = 28
and in word I also specify the numbers of Rows and Columns,so word just do
very well and my program catch a exception.

since I must write the code in c++ and this means i must specify all the
parameters , the source code list below:

CString strTableText;
strTableText = GetTableTitleString(); //this function return the strings
m_Selection.TypeText((LPCTSTR)strTableText);
m_Paragraphs = m_Document.GetParagraphs();
m_Paragraph = m_Paragraphs.GetLast();
m_Range = m_Paragraph.GetRange();
m_Range.Select();
try
{
m_Table = m_Selection.ConvertToTable(OLESHORT(wdSeparateByCo mmas),
OLESHORT(myReportData.keyNodeCount + 2),
OLESHORT(totalColumnCount),
OLESHORT(28),
OLESHORT(wdTableFormatNone),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLEBOOL(TRUE),
OLESHORT(wdAutoFitContent),
OLESHORT(wdWord9TableBehavior));
}
catch (COleDispatchException* pException) {
CString strException;
strException += "Exception Program\t:" + pException-m_strSource + "\n\n";
strException += "Exception Description\t:" + pException-m_strDescription +
"\n\n";
strException += "Exception HelpFile\t:" + pException-m_strHelpFile + "\n\n";
MessageBox(NULL,_T(LPCTSTR(strException)),_T("Exce ption Error"),MB_OK);
exceptionOccur = true;
goto WordExceptionError;
}