Board index » delphi » Parsing tables in Word

Parsing tables in Word


2005-12-14 07:36:20 PM
delphi232
I have a number of word documents with varying numbers of tables in
them. I can load the document and pull the data out of the tavbles but
I think I have a logic error in the code as the results are incorrect.
Can anyone help?
Test table has ten cells:
1 2 3 4 5
6 7 8 9 10
Output from my code looks like this:
6 1 6 6 6
6 1 6 6 6
Code:
// adjust stringgrid columns
StringGrid1.RowCount := iRows;
StringGrid1.ColCount := iCols;
// loop through cells
for iGridRows := 0 to iRows - 1 do
for jGridCols := 0 to iCols do
begin
CellText := Table.Cell(jGridCols,
iGridRows).Range.FormattedText;
if not VarisEmpty(CellText) then
begin
// Remove Tabs
CellText := StringReplace(CellText,
#$D, '', [rfReplaceAll]);
// Remove linebreaks
CellText := StringReplace(CellText, #$7, '', [rfReplaceAll]);
// fill Stringgrid
Stringgrid1.Cells[jGridCols, iGridRows] := CellText;
end;
end;
 
 

Re:Parsing tables in Word

On 14 Dec 2005 03:36:20 -0800, Will writes:
Quote
Can anyone help?
Hoi Will
You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question.
Take a look here:
<tinyurl.com/8m5nw>
which links to
<delphi.wikicities.com/wiki/Delphi_Newsgroups>