wrdDoc.Tables.Add(wrdSelection.Range, ADOTable1.FieldCount, 3);
wrdDoc.Tables.Item(1).Columns.Item(1).SetWidth(51,wdAdjustNone);
wrdDoc.Tables.Item(1).Columns.Item(2).SetWidth(20,wdAdjustNone);
wrdDoc.Tables.Item(1).Columns.Item(3).SetWidth(100,wdAdjustNone);
// Set the shading on the first row to light gray
wrdDoc.Tables.Item(1).Rows.Item(1).Cells
.Shading.BackgroundPatternColorIndex := wdGray25;
// BOLD the first row
wrdDoc.Tables.Item(1).Rows.Item(1).Range.Bold := True;
// Center the text in Cell (1,1)
wrdDoc.Tables.Item(1).Cell(1,1).Range.Paragraphs.Alignment :=
wdAlignParagraphCenter;
// Fill each row of the table with data
wrdDoc.Tables.Item(1).Cell(1, 1).Range.InsertAfter('Time');
wrdDoc.Tables.Item(1).Cell(1, 2).Range.InsertAfter('');
wrdDoc.Tables.Item(1).Cell(1, 3).Range.InsertAfter('Teacher');
[B]
For Count := 1 to (ADOTable1.FieldCount - 1) do
begin
wrdDoc.Tables.Item(1).Cell((Count + 1), 1).Range.InsertAfter(wrdMergeFields.Add(wrdSelection.Range,'Time' + IntToStr(Count)));
wrdDoc.Tables.Item(1).Cell((Count + 1), 2).Range.InsertAfter(wrdMergeFields.Add(wrdSelection.Range,'THonorific' + IntToStr(Count)));
wrdDoc.Tables.Item(1).Cell((Count + 1), 3).Range.InsertAfter(wrdMergeFields.Add(wrdSelection.Range,'TSurname' + IntToStr(Count)));
end; [/B]
My second problem is that I do not know what the correct SQL syntax is for editing the name of a column in the database (I am using Delphi 7 and Microsoft Jet Engine if that makes a difference).
The third problem is that when I add a new column to my database manually (which I need to do) I get a 'violation' error in one of my units when I activate an ADOTable. This only happens on one unit and it happens when I add a column with any name anywhere in the table. I know that is vague but I can't seem to narrow down the problem any further than that.
If you could help with me with any of those it would be great. Thanks.


Sign In
Create Account


Back to top












