Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with using Word ConvertToTable routine via delphi

Status
Not open for further replies.

Eno25

Programmer
Nov 10, 2004
9
0
0
GB
Hi there.

I'm having a problem creating a table in word. I write a string to the current document and then call ConvertToTable to convert the last paragraph.

the following is a code fragment

RangeW: Word2000.Range;
v1: Variant;
ATable: Table;
ARow: Row;

begin


RangeW := FWordDoc.Document.Paragraphs.Last.Range;
v1 := RangeW;


v1.ConvertToTable(
Separator:=wdSeparateByTabs, NumColumns:=4, NumRows:=9, Format:=wdTableFormatNone, ApplyBorders:=True, ApplyShading:= True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows:=True, ApplyLastRow:=True, ApplyFirstColumn:=True, ApplyLastColumn:=False,
AutoFit:=True, AutoFitBehavior:=wdAutoFitFixed)

The problem is that my data string contains '-' chars and despite the fact that I have specified that the string is tab delimited, the hyphens throw off the formatting.

If I 'convert text to table' via the table menu in word the table formats correctly, so it appears not to be a problem with ConvertToTable.

Any help appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top