Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Benny
 
Posts: n/a
Default can anybody help me in using the function "converttotable"

I am writing Word Automation Code in C++ and I want to convert the strings
below to a table using the parameter "wdSeparateByCommas", but it throws a
exception ,the error code is 4608. But when I copy these strings into word
and do the convertion by menus, word just do very well, can anybody help me?
The strings :
description,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.0 0,,1200.00,0.00,100.95,1200.00,0.00,0.00,0.00,0.00 ,,1342.23,23.71,100.95,1338.21,-5.51,28.48,-5.51,5.00,,1552.57,23.71,100.95,1530.80,-21.57,111.50,-21.57,0.00,,2232.51,91.00,300.00,2000.17,199.79,-134.73,199.79,5.00,,2242.51,91.00,300.00,2000.00,2 04.79,-143.39,204.79,0.00,,2273.10,90.00,305.00,1999.73,2 21.22,-169.18,221.22,5.00,,5600.00,90.00,305.00,1999.73,2 129.45,-2894.42,2129.45,0.00
  #2   Report Post  
Posted to microsoft.public.word.tables
macropod
 
Posts: n/a
Default can anybody help me in using the function "converttotable"

Hi Benny,

I'm surprised Word lets you convert those strings to a table. Doing so would
require a 72-column table, but the column limit in Word (at least up to Word
2000) is 63.

Cheers

--
macropod
[MVP - Microsoft Word]


"Benny" wrote in message
...
I am writing Word Automation Code in C++ and I want to convert the strings
below to a table using the parameter "wdSeparateByCommas", but it throws a
exception ,the error code is 4608. But when I copy these strings into word
and do the convertion by menus, word just do very well, can anybody help

me?
The strings :

description,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.0 0,,1200.00,0.00,100.95,120
0.00,0.00,0.00,0.00,0.00,,1342.23,23.71,100.95,133 8.21,-5.51,28.48,-5.51,5.0
0,,1552.57,23.71,100.95,1530.80,-21.57,111.50,-21.57,0.00,,2232.51,91.00,300
..00,2000.17,199.79,-134.73,199.79,5.00,,2242.51,91.00,300.00,2000.00,2 04.79,
-143.39,204.79,0.00,,2273.10,90.00,305.00,1999.73,2 21.22,-169.18,221.22,5.00
,,5600.00,90.00,305.00,1999.73,2129.45,-2894.42,2129.45,0.00


  #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;
}

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"paste" function failure in MS Word rhaggard Page Layout 0 April 8th 06 07:54 PM
How to overwrite shortcut keys function in word [email protected] Microsoft Word Help 4 October 7th 05 06:55 PM
Text to Speech Function is available in Excel but not in Word Shrikant Microsoft Word Help 1 August 9th 05 02:32 PM
VBA function results in fields Robert Mulroney Microsoft Word Help 3 July 5th 05 09:03 AM
Word Compare and Merge Document Function EricM Microsoft Word Help 2 March 28th 05 11:53 PM


All times are GMT +1. The time now is 01:26 PM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"