I am trying to create a report using the TPrinter object. The report shows the dates and times all the people in a group participated. There is a max of 10 days that the people could show up, but it could be less than that. I have created a TStringList to hold the unique dates that I need in the header of the report:
DateString:
2/22/06
2/23/06
2/24/06
2/27/06
2/28/06
3/2/06
3/6/06
I have created a set of constants that align to the columns on the page I am trying to print:
const
column0 = 3.75;
column1 = 4.375;
column2 = 5.0;
column3 = 5.625;
column4 = 6.25;
column5 = 6.875;
column6 = 7.5;
column7 = 8.1875;
column8 = 8.75;
column9 = 9.4375;
column10 = 10.0;
I would like to loop through the DateString and fill in only the ones that have a corresponding date. So in this example, only columns 0 - 6 need a date at the top. However, I can't seem to get the syntax correct for the loop to substitute 'i' for the last part of the column name. I have tried:
I would expect the bold section above to return Column0 which correlates to the const Column0, but that didn't work. So I tried declaring ColumnName as a variant, but that bombed too.
Does anyone know how I can accomplish this?
Thanks!
leslie
DateString:
2/22/06
2/23/06
2/24/06
2/27/06
2/28/06
3/2/06
3/6/06
I have created a set of constants that align to the columns on the page I am trying to print:
const
column0 = 3.75;
column1 = 4.375;
column2 = 5.0;
column3 = 5.625;
column4 = 6.25;
column5 = 6.875;
column6 = 7.5;
column7 = 8.1875;
column8 = 8.75;
column9 = 9.4375;
column10 = 10.0;
I would like to loop through the DateString and fill in only the ones that have a corresponding date. So in this example, only columns 0 - 6 need a date at the top. However, I can't seem to get the syntax correct for the loop to substitute 'i' for the last part of the column name. I have tried:
Code:
for i := 0 to DateString.Count - 1 do
Printer.Canvas.TextOut((trunc([b](Column + IntToStr(i))[/b] * PixPerInX) - OffsetX), trunc((topmargin * PixPerInY) - OffsetY), DateString[i]);
end;
I would expect the bold section above to return Column0 which correlates to the const Column0, but that didn't work. So I tried declaring ColumnName as a variant, but that bombed too.
Code:
for i := 0 to DateString.Count - 1 do
begin
ColumnName := 'Column' + IntToStr(i);
Printer.Canvas.TextOut((trunc([b]ColumnName[/b] * PixPerInX) - OffsetX), trunc((topmargin * PixPerInY) - OffsetY), DateString[i]);
end;
Does anyone know how I can accomplish this?
Thanks!
leslie