I did mostly exactly this about five, six years ago, using Delphi 7 and ReportBuilder 7.04. Eventually, I basically discarded the report wizard, breaking the report up into a max of 4 pages and doing one report for each page. I just through basic objects onto each page and then I coded each page by hand, resetting things each time. Bit of a nightmare, but I'm fairly proud of the result. One of the things I had done was a whole set of the soil types that I loaded in as images.
Here's the main routine. Isn't the whole thing and would probably benefit from refactoring all these years later. but it will get you a basic idea of what I did.
GM
procedure TFrmMain.PrintGraphicReport(Sender: TObject); const CONTINU = 'Continued...'; depthIndHt = 0.1771; var gwd: extended; msg : string; grMetres : extended; grPages, grStartPg, grEndPg: byte; grTop, TempTop : extended; BOnPg, EOnPg : byte; PDFnameStart, PDFname : string; begin msg := GetExitReportCreationNote; if msg <> '' then begin OptionOOPS('EXITING REPORT: ' + msg); exit; end; // get the footer note for the report SetReportFooterNote; // if not previously loaded the custom bitmaps for the patterns, load them now if not LoadedBitmaps then begin LoadTheBitmaps; LoadedBitmaps := true; end;
// redo grMaxMetresBoth if it is ZERO, meaning no samples or soil // Get the deepest measurement monitor // 8/20/2004 1:32:34 AM if grMaxMetresBoth = 0.0 then begin grMaxMetresBoth := dData.tblTestHole.fieldByName('BottomSandpack').asFloat * Ft2M; ShowDlgOops('This report has no sample or soil data to display. ' + 'Adjusting report to accomodate monitor (' + floatToStr(grMaxMetresBoth) + ').'); end;
// Get which inch scale to use if grMaxMetresBoth < 5.00001 then UseInches := th5Inches else UseInches := th10Inches; // Determine the pages we will be using if grMaxMetresBoth > 30.0 then begin grPages := 4; grStartPg := 1; grEndPg := grPages; end else if grMaxMetresBoth > 20.0 then begin grPages := 3; grStartPg := 1; grEndPg := grPages; end else if grMaxMetresBoth > 10.0 then begin grPages := 2; grStartPg := 1; grEndPg := grPages; end else if grMaxMetresBoth > 5.0 then begin grPages := 1; grStartPg := 1; grEndPg := 1; end else begin grPages := 1; grStartPg := 0; grEndPg := 0; end;
// Fill in the header info on each page FillReportHeader(grEndPg);
// Initialize variables that we need for this report grSampleObject := 1; grSoilObject := grSampleObject; grTop := 0.0; // Loop through the samples and create the objects with dData.TblSample do begin first; while not eof do begin // this object must start on a page. Whether it ends there is another matter grMetres := Ft2M * fieldByName('UpperDepth').asFloat; if grMetres < 10.00001 then BOnPg := 1 else if grMetres < 20.00001 then BOnPg := 2 else if grMetres < 30.00001 then BOnPg := 3 else BOnPg := 4; // Let's get the End Page grMetres := Ft2M * fieldByName('LowerDepth').asFloat; if grMetres < 10.00001 then EOnPg := 1 else if grMetres < 20.00001 then EOnPg := 2 else if grMetres < 30.00001 then EOnPg := 3 else EOnPg := 4; { CS S }CodeSite.SendMsg('This is the samples loop');{ CS E }; { CS S }CodeSite.SendFloat('grMetres', grMetres);{ CS E }; { CS S }CodeSite.SendInteger('BOnPg', BOnPg);{ CS E }; { CS S }CodeSite.SendInteger('EOnPg', EOnPg);{ CS E }; if BOnPg = EOnPg then begin // great we have a one page object case BOnPg of 1 : if UseInches = Th5Inches // is it a 5m or 10m page then CreateSampleObjects(grSampleObject,th5DetailBand) else CreateSampleObjects(grSampleObject,th10DetailBand); 2 : CreateSampleObjects(grSampleObject,th20DetailBand); 3 : CreateSampleObjects(grSampleObject,th30DetailBand); 4 : CreateSampleObjects(grSampleObject,th40DetailBand); end; TempTop := FillOnePgSampleData(grSampleObject,grTop + SampleMargin,BOnPg); end else begin // rats we have a two page object case BOnPg of 1 : if UseInches = Th5Inches // is it a 5m or 10m page then CreateSampleObjects(grSampleObject,th5DetailBand) else CreateSampleObjects(grSampleObject,th10DetailBand); 2 : CreateSampleObjects(grSampleObject,th20DetailBand); 3 : CreateSampleObjects(grSampleObject,th30DetailBand); 4 : CreateSampleObjects(grSampleObject,th40DetailBand); end; TempTop := FillOnePgSampleData(grSampleObject,grTop + SampleMargin,BOnPg); inc(grSampleObject); case EOnPg of 2 : CreateSampleObjects(grSampleObject,th20DetailBand); 3 : CreateSampleObjects(grSampleObject,th30DetailBand); 4 : CreateSampleObjects(grSampleObject,th40DetailBand); end; TempTop := FillOnePgSampleData(grSampleObject,0,EOnPg); end; grTop := TempTop; // reassigning var thru function creates AV error inc(grSampleObject); next; end; end;
// RESet some variables that we need for this report grTop := 0.0;
//////////////////////////////////////////////////////////////////////// / //////////////////////////////////////////////////////////////////////// / // Loop through the soil and create the objects with dData.TblSoil do begin first; while not eof do begin // this object must start on a page. Whether it ends there is another matter grMetres := Ft2M * fieldByName('UpperDepth').asFloat; if grMetres < 10.00001 then BOnPg := 1 else if grMetres < 20.00001 then BOnPg := 2 else if grMetres < 30.00001 then BOnPg := 3 else BOnPg := 4; // Let's get the End Page grMetres := Ft2M * fieldByName('LowerDepth').asFloat; if grMetres < 10.00001 then EOnPg := 1 else if grMetres < 20.00001 then EOnPg := 2 else if grMetres < 30.00001 then EOnPg := 3 else EOnPg := 4; if BOnPg = EOnPg then begin // Great, it's a one page object case BOnPg of 1 : if UseInches = Th5Inches // is it a 5m or 10m page then CreateSoilObjects(grSoilObject,th5DetailBand) else CreateSoilObjects(grSoilObject,th10DetailBand); 2 : CreateSoilObjects(grSoilObject,th20DetailBand); 3 : CreateSoilObjects(grSoilObject,th30DetailBand); 4 : CreateSoilObjects(grSoilObject,th40DetailBand); end; TempTop := FillOnePgSoilData(grSoilObject,grTop,BOnPg); end else begin // gotta do TWO objects one on BOnPg and the other on EOnPg case BOnPg of 1 : if UseInches = Th5Inches // is it a 5m or 10m page then CreateSoilObjects(grSoilObject,th5DetailBand) else CreateSoilObjects(grSoilObject,th10DetailBand); 2 : CreateSoilObjects(grSoilObject,th20DetailBand); 3 : CreateSoilObjects(grSoilObject,th30DetailBand); 4 : CreateSoilObjects(grSoilObject,th40DetailBand); end; TempTop := FillOnePgSoilData(grSoilObject,grTop,BOnPg); inc(grSoilObject); if mOOldDesigner.checked then begin case EOnPg of 2 : CreateSoilObjects(grSoilObject,th20DetailBand); 3 : begin CreateSoilObjects(grSoilObject,th30DetailBand); end; 4 : begin CreateSoilObjects(grSoilObject,th40DetailBand); end; end; TempTop := FillOnePgSoilDataPart2(grSoilObject,0,EOnPg); end else begin case EOnPg of 2 : begin CreateSoilObjects(grSoilObject,th20DetailBand); TempTop := FillOnePgSoilDataPart2(grSoilObject,0,2); end; 3 : begin CreateSoilObjects(grSoilObject,th20DetailBand); TempTop := FillOnePgSoilDataPart2(grSoilObject,0,2); inc(grSoilObject); CreateSoilObjects(grSoilObject,th30DetailBand); TempTop := FillOnePgSoilDataPart2(grSoilObject,0,3); end; 4 : begin CreateSoilObjects(grSoilObject,th20DetailBand); TempTop := FillOnePgSoilDataPart2(grSoilObject,0,2); inc(grSoilObject); CreateSoilObjects(grSoilObject,th30DetailBand); TempTop := FillOnePgSoilDataPart2(grSoilObject,0,3); inc(grSoilObject); CreateSoilObjects(grSoilObject,th40DetailBand); TempTop := FillOnePgSoilDataPart2(grSoilObject,0,4); end; end; end; // grTop := 10.0; end; grTop := TempTop; // reassigning var thru function creates AV error inc(grSoilObject); next; end; end;
// Do the monitor BuildGRMonitor(grStartPg, grEndPg);
// Do the GroundWaterDepth marker th5GWDepthIndicator.height := depthIndHt; // reset the height in case squashed th10GWDepthIndicator.height := depthIndHt; th20GWDepthIndicator.height := depthIndHt; th30GWDepthIndicator.height := depthIndHt; th40GWDepthIndicator.height := depthIndHt;
th5GWDepthIndicator.visible := false; // turn off all indicators th10GWDepthIndicator.visible := false; th20GWDepthIndicator.visible := false; th30GWDepthIndicator.visible := false; th40GWDepthIndicator.visible := false; gwd := getF(dData.TblTestHole,'GroundWaterDepth'); // already in metres if gwd > 30 then begin th40GWDepthIndicator.visible := true; gwd := (gwd-30) * UseInches; //gwd := convertF(gwd,4) * UseInches; if depthIndHt > gwd then begin th40GWDepthIndicator.top := 0; th40GWDepthIndicator.height := gwd; end else th40GWDepthIndicator.top := gwd - depthIndHt; end else if gwd > 20 then begin th30GWDepthIndicator.visible := true; gwd := (gwd-20) * UseInches; if depthIndHt > gwd then begin th30GWDepthIndicator.top := 0; th30GWDepthIndicator.height := gwd; end else th30GWDepthIndicator.top := gwd - depthIndHt; end else if gwd > 10 then begin th20GWDepthIndicator.visible := true; gwd := (gwd-10) * UseInches; if depthIndHt > gwd then begin th20GWDepthIndicator.top := 0; th20GWDepthIndicator.height := gwd; end else th20GWDepthIndicator.top := gwd - depthIndHt; end else begin gwd := convertF(gwd,1) * UseInches; if depthIndHt > gwd then begin th10GWDepthIndicator.top := 0; th10GWDepthIndicator.height := gwd; end else th10GWDepthIndicator.top := gwd - depthIndHt; th5GWDepthIndicator.top := th10GWDepthIndicator.top; th5GWDepthIndicator.height := th10GWDepthIndicator.height; if gwd > 0 then begin th10GWDepthIndicator.visible := true; th5GWDepthIndicator.visible := true; end; end;
// Print the Report(s) case grStartPg of 0 : pipTH5.print; 1 : case grEndPg of 1 : pipth10.Print; 2 : begin th10LblContinued.caption := CONTINU; pipth10.Print; pipTH20.print; end; 3 : begin th10LblContinued.caption := CONTINU; th20LblContinued.caption := CONTINU; pipth10.Print; pipTH20.print; pipTH30.print; end; 4 : begin th10LblContinued.caption := CONTINU; th20LblContinued.caption := CONTINU; th30LblContinued.caption := CONTINU; pipth10.Print; pipTH20.print; pipTH30.print; pipTH40.print; end; end; end;
// Store Info in DATUM with dData.TblDatum do begin active := true; append; fieldByName('PrintedDate').asDateTime := date; fieldByName('PrintedTime').asDateTime := time; fieldByName('PrintedBy').asString := Globals.UserName; fieldByName('ProjNum').asString := th10ProjNum.caption; fieldByName('TestHoleNum').asString := getS(dData.TblTestHole,'TestHoleNum'); fieldByName('Datum').asString := th10Datum.caption; post; end;
// optionally print PDF if mUseDefaultPDF.checked = true then pdfNameStart := 'c:\data\LogPg' else pdfNameStart := 'c:\data\' + getS(dData.TblTestHole,'TestHoleNum') + 'LogPg'; if (mOAskPDF.checked and OptionConfirm('Do you wish to store PDF versions of the printouts in C:\DATA?')) then case grStartPg of 0 : begin pdfName := pdfNameStart + '1.pdf'; exporttoPDF(pipTH5,pdfName, false, true, false); end; 1 : begin pdfName := pdfNameStart + '1.pdf'; exporttoPDF(pipTH10,pdfName, false, true, false); if grEndPg > 1 then begin pdfName := pdfNameStart + '2.pdf'; exporttoPDF(pipTH20,pdfName, false, true, false); if grEndPg > 2 then begin pdfName := pdfNameStart + '3.pdf'; exporttoPDF(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.pdf'; exporttoPDF(pipTH40,pdfName, false, true, false); end; end; end; end; 2 : begin pdfName := pdfNameStart + '2.pdf'; exporttoPDF(pipTH20,pdfName, false, true, false); if grEndPg > 2 then begin pdfName := pdfNameStart + '3.pdf'; exporttoPDF(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.pdf'; exporttoPDF(pipTH40,pdfName, false, true, false); end; end; end; 3 : begin pdfName := pdfNameStart + '3.pdf'; exporttoPDF(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.pdf'; exporttoPDF(pipTH40,pdfName, false, true, false); end; end; 4 : begin pdfName := pdfNameStart + '4.pdf'; exporttoPDF(pipTH40,pdfName, false, true, false); end; end;
// optionally print XLS if mUseDefaultPDF.checked = true then pdfNameStart := 'c:\data\LogPg' else pdfNameStart := 'c:\data\' + getS(dData.TblTestHole,'TestHoleNum') + 'LogPg'; if (mOAskXLS.checked and OptionConfirm('Do you wish to store Excel versions of the reports in C:\DATA?')) then case grStartPg of 0 : begin pdfName := pdfNameStart + '1.XLS'; exporttoExcel(pipTH5,pdfName, false, true, false); end; 1 : begin pdfName := pdfNameStart + '1.XLS'; exporttoExcel(pipTH10,pdfName, false, true, false); if grEndPg > 1 then begin pdfName := pdfNameStart + '2.XLS'; exporttoExcel(pipTH20,pdfName, false, true, false); if grEndPg > 2 then begin pdfName := pdfNameStart + '3.XLS'; exporttoExcel(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.XLS'; exporttoExcel(pipTH40,pdfName, false, true, false); end; end; end; end; 2 : begin pdfName := pdfNameStart + '2.XLS'; exporttoExcel(pipTH20,pdfName, false, true, false); if grEndPg > 2 then begin pdfName := pdfNameStart + '3.XLS'; exporttoExcel(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.XLS'; exporttoExcel(pipTH40,pdfName, false, true, false); end; end; end; 3 : begin pdfName := pdfNameStart + '3.XLS'; exporttoExcel(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.XLS'; exporttoExcel(pipTH40,pdfName, false, true, false); end; end; 4 : begin pdfName := pdfNameStart + '4.XLS'; exporttoExcel(pipTH40,pdfName, false, true, false); end; end;
// optionally print HTML if mUseDefaultPDF.checked = true then pdfNameStart := 'c:\data\LogPg' else pdfNameStart := 'c:\data\' + getS(dData.TblTestHole,'TestHoleNum') + 'LogPg'; if (mOAskHTML.checked and OptionConfirm('Do you wish to store a HTML version of the reports in C:\DATA?')) then case grStartPg of 0 : begin pdfName := pdfNameStart + '1.HTM'; exporttoHTML(pipTH5,pdfName, false, true, false); end; 1 : begin pdfName := pdfNameStart + '1.HTM'; exporttoHTML(pipTH10,pdfName, false, true, false); if grEndPg > 1 then begin pdfName := pdfNameStart + '2.HTM'; exporttoHTML(pipTH20,pdfName, false, true, false); if grEndPg > 2 then begin pdfName := pdfNameStart + '3.HTM'; exporttoHTML(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.HTM'; exporttoHTML(pipTH40,pdfName, false, true, false); end; end; end; end; 2 : begin pdfName := pdfNameStart + '2.HTM'; exporttoHTML(pipTH20,pdfName, false, true, false); if grEndPg > 2 then begin pdfName := pdfNameStart + '3.HTM'; exporttoHTML(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.HTM'; exporttoHTML(pipTH40,pdfName, false, true, false); end; end; end; 3 : begin pdfName := pdfNameStart + '3.HTM'; exporttoHTML(pipTH30,pdfName, false, true, false); if grEndPg > 3 then begin pdfName := pdfNameStart + '4.HTM'; exporttoHTML(pipTH40,pdfName, false, true, false); end; end; 4 : begin pdfName := pdfNameStart + '4.HTM'; exporttoHTML(pipTH40,pdfName, false, true, false); end; end;
Forgot to mention, because it might actually BE the actual answer to your question ....
These Big bitmaps were basically 11 inch high graphics. Didn't stretch OR auto-size, just chopped off the button and right side as needed. Sure gooses the size of the executable, but it solved THAT issue completely for me.
There was no attachment - but that is good because attachments should never posted to the newsgroups. You can send attachments to support@
Data..
One option would be to create a set of bitmaps (or jpegs) that represent each of the soil patterns. For each bitmap use the max height and width that you will ever need. Store the bitmaps in files with relevant file names (or store them in a separate database table). Then create some data that describes the soil boring log. In the data refer to the bitmap file name (or refer to the pattern id if storing bitmaps in a database). So at this point we have some log data and some bitmaps.
Layout..
For the report layout use a DBImage to display the soil patterns. The DBImage can be connected to the field that contains the bitmap filenames. DBImage will automatically load and display the bitmap. Implement the DetailBand.BeforePrint event to resize the height of the DBImage base on the log data. The DBImage will only show the part of the bitmap that falls within its bounds. (If you store the bitmap patterns in a database, then just do a SQL join and connect the DBImage to the blob field).
-- Nard Moseley Digital Metaphors www.digital-metaphors.com
Best regards,
Nard Moseley Digital Metaphors www.digital-metaphors.com
Nard Moseley (Digital Metaphors) wrote: Thanks for the help. I sort of thought of the same approach, but wasn't sure if it was the way to go. Sorry about the attachment.
Comments
Craig,
I did mostly exactly this about five, six years ago, using Delphi 7
and ReportBuilder 7.04. Eventually, I basically discarded the report
wizard, breaking the report up into a max of 4 pages and doing one
report for each page. I just through basic objects onto each page and
then I coded each page by hand, resetting things each time. Bit of a
nightmare, but I'm fairly proud of the result. One of the things I had
done was a whole set of the soil types that I loaded in as images.
Here's the main routine. Isn't the whole thing and would probably
benefit from refactoring all these years later. but it will get you a
basic idea of what I did.
GM
procedure TFrmMain.PrintGraphicReport(Sender: TObject);
const
CONTINU = 'Continued...';
depthIndHt = 0.1771;
var
gwd: extended;
msg : string;
grMetres : extended;
grPages, grStartPg, grEndPg: byte;
grTop, TempTop : extended;
BOnPg, EOnPg : byte;
PDFnameStart, PDFname : string;
begin
msg := GetExitReportCreationNote;
if msg <> ''
then begin
OptionOOPS('EXITING REPORT: ' + msg);
exit;
end;
// get the footer note for the report
SetReportFooterNote;
// if not previously loaded the custom bitmaps for the patterns, load
them now
if not LoadedBitmaps
then begin
LoadTheBitmaps;
LoadedBitmaps := true;
end;
// redo grMaxMetresBoth if it is ZERO, meaning no samples or soil
// Get the deepest measurement monitor // 8/20/2004 1:32:34 AM
if grMaxMetresBoth = 0.0
then begin
grMaxMetresBoth :=
dData.tblTestHole.fieldByName('BottomSandpack').asFloat * Ft2M;
ShowDlgOops('This report has no sample or soil data to display. '
+
'Adjusting report to accomodate monitor (' +
floatToStr(grMaxMetresBoth) + ').');
end;
// Get which inch scale to use
if grMaxMetresBoth < 5.00001
then UseInches := th5Inches
else UseInches := th10Inches;
// Determine the pages we will be using
if grMaxMetresBoth > 30.0
then begin
grPages := 4;
grStartPg := 1;
grEndPg := grPages;
end
else if grMaxMetresBoth > 20.0
then begin
grPages := 3;
grStartPg := 1;
grEndPg := grPages;
end
else if grMaxMetresBoth > 10.0
then begin
grPages := 2;
grStartPg := 1;
grEndPg := grPages;
end
else if grMaxMetresBoth > 5.0
then begin
grPages := 1;
grStartPg := 1;
grEndPg := 1;
end
else begin
grPages := 1;
grStartPg := 0;
grEndPg := 0;
end;
// Fill in the header info on each page
FillReportHeader(grEndPg);
// Initialize variables that we need for this report
grSampleObject := 1;
grSoilObject := grSampleObject;
grTop := 0.0;
// Loop through the samples and create the objects
with dData.TblSample do begin
first;
while not eof do begin
// this object must start on a page. Whether it ends there is
another matter
grMetres := Ft2M * fieldByName('UpperDepth').asFloat;
if grMetres < 10.00001
then BOnPg := 1
else if grMetres < 20.00001
then BOnPg := 2
else if grMetres < 30.00001
then BOnPg := 3
else BOnPg := 4;
// Let's get the End Page
grMetres := Ft2M * fieldByName('LowerDepth').asFloat;
if grMetres < 10.00001
then EOnPg := 1
else if grMetres < 20.00001
then EOnPg := 2
else if grMetres < 30.00001
then EOnPg := 3
else EOnPg := 4;
{ CS S }CodeSite.SendMsg('This is the samples loop');{ CS E };
{ CS S }CodeSite.SendFloat('grMetres', grMetres);{ CS E };
{ CS S }CodeSite.SendInteger('BOnPg', BOnPg);{ CS E };
{ CS S }CodeSite.SendInteger('EOnPg', EOnPg);{ CS E };
if BOnPg = EOnPg
then begin // great we have a one page object
case BOnPg of
1 : if UseInches = Th5Inches // is it a 5m or 10m page
then CreateSampleObjects(grSampleObject,th5DetailBand)
else
CreateSampleObjects(grSampleObject,th10DetailBand);
2 : CreateSampleObjects(grSampleObject,th20DetailBand);
3 : CreateSampleObjects(grSampleObject,th30DetailBand);
4 : CreateSampleObjects(grSampleObject,th40DetailBand);
end;
TempTop := FillOnePgSampleData(grSampleObject,grTop +
SampleMargin,BOnPg);
end
else begin // rats we have a two page object
case BOnPg of
1 : if UseInches = Th5Inches // is it a 5m or 10m page
then CreateSampleObjects(grSampleObject,th5DetailBand)
else
CreateSampleObjects(grSampleObject,th10DetailBand);
2 : CreateSampleObjects(grSampleObject,th20DetailBand);
3 : CreateSampleObjects(grSampleObject,th30DetailBand);
4 : CreateSampleObjects(grSampleObject,th40DetailBand);
end;
TempTop := FillOnePgSampleData(grSampleObject,grTop +
SampleMargin,BOnPg);
inc(grSampleObject);
case EOnPg of
2 : CreateSampleObjects(grSampleObject,th20DetailBand);
3 : CreateSampleObjects(grSampleObject,th30DetailBand);
4 : CreateSampleObjects(grSampleObject,th40DetailBand);
end;
TempTop := FillOnePgSampleData(grSampleObject,0,EOnPg);
end;
grTop := TempTop; // reassigning var thru function creates AV
error
inc(grSampleObject);
next;
end;
end;
// RESet some variables that we need for this report
grTop := 0.0;
////////////////////////////////////////////////////////////////////////
/
////////////////////////////////////////////////////////////////////////
/
// Loop through the soil and create the objects
with dData.TblSoil do begin
first;
while not eof do begin
// this object must start on a page. Whether it ends there is
another matter
grMetres := Ft2M * fieldByName('UpperDepth').asFloat;
if grMetres < 10.00001
then BOnPg := 1
else if grMetres < 20.00001
then BOnPg := 2
else if grMetres < 30.00001
then BOnPg := 3
else BOnPg := 4;
// Let's get the End Page
grMetres := Ft2M * fieldByName('LowerDepth').asFloat;
if grMetres < 10.00001
then EOnPg := 1
else if grMetres < 20.00001
then EOnPg := 2
else if grMetres < 30.00001
then EOnPg := 3
else EOnPg := 4;
if BOnPg = EOnPg
then begin // Great, it's a one page object
case BOnPg of
1 : if UseInches = Th5Inches // is it a 5m or 10m page
then CreateSoilObjects(grSoilObject,th5DetailBand)
else CreateSoilObjects(grSoilObject,th10DetailBand);
2 : CreateSoilObjects(grSoilObject,th20DetailBand);
3 : CreateSoilObjects(grSoilObject,th30DetailBand);
4 : CreateSoilObjects(grSoilObject,th40DetailBand);
end;
TempTop := FillOnePgSoilData(grSoilObject,grTop,BOnPg);
end
else begin // gotta do TWO objects one on BOnPg and the other
on EOnPg
case BOnPg of
1 : if UseInches = Th5Inches // is it a 5m or 10m page
then CreateSoilObjects(grSoilObject,th5DetailBand)
else CreateSoilObjects(grSoilObject,th10DetailBand);
2 : CreateSoilObjects(grSoilObject,th20DetailBand);
3 : CreateSoilObjects(grSoilObject,th30DetailBand);
4 : CreateSoilObjects(grSoilObject,th40DetailBand);
end;
TempTop := FillOnePgSoilData(grSoilObject,grTop,BOnPg);
inc(grSoilObject);
if mOOldDesigner.checked
then begin
case EOnPg of
2 : CreateSoilObjects(grSoilObject,th20DetailBand);
3 : begin
CreateSoilObjects(grSoilObject,th30DetailBand);
end;
4 : begin
CreateSoilObjects(grSoilObject,th40DetailBand);
end;
end;
TempTop := FillOnePgSoilDataPart2(grSoilObject,0,EOnPg);
end
else begin
case EOnPg of
2 : begin
CreateSoilObjects(grSoilObject,th20DetailBand);
TempTop :=
FillOnePgSoilDataPart2(grSoilObject,0,2);
end;
3 : begin
CreateSoilObjects(grSoilObject,th20DetailBand);
TempTop :=
FillOnePgSoilDataPart2(grSoilObject,0,2);
inc(grSoilObject);
CreateSoilObjects(grSoilObject,th30DetailBand);
TempTop :=
FillOnePgSoilDataPart2(grSoilObject,0,3);
end;
4 : begin
CreateSoilObjects(grSoilObject,th20DetailBand);
TempTop :=
FillOnePgSoilDataPart2(grSoilObject,0,2);
inc(grSoilObject);
CreateSoilObjects(grSoilObject,th30DetailBand);
TempTop :=
FillOnePgSoilDataPart2(grSoilObject,0,3);
inc(grSoilObject);
CreateSoilObjects(grSoilObject,th40DetailBand);
TempTop :=
FillOnePgSoilDataPart2(grSoilObject,0,4);
end;
end;
end;
// grTop := 10.0;
end;
grTop := TempTop; // reassigning var thru function creates AV
error
inc(grSoilObject);
next;
end;
end;
// Do the monitor
BuildGRMonitor(grStartPg, grEndPg);
// Do the GroundWaterDepth marker
th5GWDepthIndicator.height := depthIndHt; // reset the height in
case squashed
th10GWDepthIndicator.height := depthIndHt;
th20GWDepthIndicator.height := depthIndHt;
th30GWDepthIndicator.height := depthIndHt;
th40GWDepthIndicator.height := depthIndHt;
th5GWDepthIndicator.visible := false; // turn off all indicators
th10GWDepthIndicator.visible := false;
th20GWDepthIndicator.visible := false;
th30GWDepthIndicator.visible := false;
th40GWDepthIndicator.visible := false;
gwd := getF(dData.TblTestHole,'GroundWaterDepth'); // already in
metres
if gwd > 30
then begin
th40GWDepthIndicator.visible := true;
gwd := (gwd-30) * UseInches;
//gwd := convertF(gwd,4) * UseInches;
if depthIndHt > gwd
then begin
th40GWDepthIndicator.top := 0;
th40GWDepthIndicator.height := gwd;
end
else th40GWDepthIndicator.top := gwd - depthIndHt;
end
else if gwd > 20
then begin
th30GWDepthIndicator.visible := true;
gwd := (gwd-20) * UseInches;
if depthIndHt > gwd
then begin
th30GWDepthIndicator.top := 0;
th30GWDepthIndicator.height := gwd;
end
else th30GWDepthIndicator.top := gwd - depthIndHt;
end
else if gwd > 10
then begin
th20GWDepthIndicator.visible := true;
gwd := (gwd-10) * UseInches;
if depthIndHt > gwd
then begin
th20GWDepthIndicator.top := 0;
th20GWDepthIndicator.height := gwd;
end
else th20GWDepthIndicator.top := gwd - depthIndHt;
end
else begin
gwd := convertF(gwd,1) * UseInches;
if depthIndHt > gwd
then begin
th10GWDepthIndicator.top := 0;
th10GWDepthIndicator.height := gwd;
end
else th10GWDepthIndicator.top := gwd - depthIndHt;
th5GWDepthIndicator.top := th10GWDepthIndicator.top;
th5GWDepthIndicator.height := th10GWDepthIndicator.height;
if gwd > 0
then begin
th10GWDepthIndicator.visible := true;
th5GWDepthIndicator.visible := true;
end;
end;
// Print the Report(s)
case grStartPg of
0 : pipTH5.print;
1 : case grEndPg of
1 : pipth10.Print;
2 : begin
th10LblContinued.caption := CONTINU;
pipth10.Print;
pipTH20.print;
end;
3 : begin
th10LblContinued.caption := CONTINU;
th20LblContinued.caption := CONTINU;
pipth10.Print;
pipTH20.print;
pipTH30.print;
end;
4 : begin
th10LblContinued.caption := CONTINU;
th20LblContinued.caption := CONTINU;
th30LblContinued.caption := CONTINU;
pipth10.Print;
pipTH20.print;
pipTH30.print;
pipTH40.print;
end;
end;
end;
// Store Info in DATUM
with dData.TblDatum do begin
active := true;
append;
fieldByName('PrintedDate').asDateTime := date;
fieldByName('PrintedTime').asDateTime := time;
fieldByName('PrintedBy').asString := Globals.UserName;
fieldByName('ProjNum').asString := th10ProjNum.caption;
fieldByName('TestHoleNum').asString :=
getS(dData.TblTestHole,'TestHoleNum');
fieldByName('Datum').asString := th10Datum.caption;
post;
end;
// optionally print PDF
if mUseDefaultPDF.checked = true
then pdfNameStart := 'c:\data\LogPg'
else pdfNameStart := 'c:\data\' +
getS(dData.TblTestHole,'TestHoleNum') + 'LogPg';
if (mOAskPDF.checked and
OptionConfirm('Do you wish to store PDF versions of the printouts
in C:\DATA?'))
then case grStartPg of
0 : begin
pdfName := pdfNameStart + '1.pdf';
exporttoPDF(pipTH5,pdfName, false, true, false);
end;
1 : begin
pdfName := pdfNameStart + '1.pdf';
exporttoPDF(pipTH10,pdfName, false, true, false);
if grEndPg > 1
then begin
pdfName := pdfNameStart + '2.pdf';
exporttoPDF(pipTH20,pdfName, false, true, false);
if grEndPg > 2
then begin
pdfName := pdfNameStart + '3.pdf';
exporttoPDF(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.pdf';
exporttoPDF(pipTH40,pdfName, false, true,
false);
end;
end;
end;
end;
2 : begin
pdfName := pdfNameStart + '2.pdf';
exporttoPDF(pipTH20,pdfName, false, true, false);
if grEndPg > 2
then begin
pdfName := pdfNameStart + '3.pdf';
exporttoPDF(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.pdf';
exporttoPDF(pipTH40,pdfName, false, true, false);
end;
end;
end;
3 : begin
pdfName := pdfNameStart + '3.pdf';
exporttoPDF(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.pdf';
exporttoPDF(pipTH40,pdfName, false, true, false);
end;
end;
4 : begin
pdfName := pdfNameStart + '4.pdf';
exporttoPDF(pipTH40,pdfName, false, true, false);
end;
end;
// optionally print XLS
if mUseDefaultPDF.checked = true
then pdfNameStart := 'c:\data\LogPg'
else pdfNameStart := 'c:\data\' +
getS(dData.TblTestHole,'TestHoleNum') + 'LogPg';
if (mOAskXLS.checked and
OptionConfirm('Do you wish to store Excel versions of the reports
in C:\DATA?'))
then case grStartPg of
0 : begin
pdfName := pdfNameStart + '1.XLS';
exporttoExcel(pipTH5,pdfName, false, true, false);
end;
1 : begin
pdfName := pdfNameStart + '1.XLS';
exporttoExcel(pipTH10,pdfName, false, true, false);
if grEndPg > 1
then begin
pdfName := pdfNameStart + '2.XLS';
exporttoExcel(pipTH20,pdfName, false, true, false);
if grEndPg > 2
then begin
pdfName := pdfNameStart + '3.XLS';
exporttoExcel(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.XLS';
exporttoExcel(pipTH40,pdfName, false, true,
false);
end;
end;
end;
end;
2 : begin
pdfName := pdfNameStart + '2.XLS';
exporttoExcel(pipTH20,pdfName, false, true, false);
if grEndPg > 2
then begin
pdfName := pdfNameStart + '3.XLS';
exporttoExcel(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.XLS';
exporttoExcel(pipTH40,pdfName, false, true, false);
end;
end;
end;
3 : begin
pdfName := pdfNameStart + '3.XLS';
exporttoExcel(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.XLS';
exporttoExcel(pipTH40,pdfName, false, true, false);
end;
end;
4 : begin
pdfName := pdfNameStart + '4.XLS';
exporttoExcel(pipTH40,pdfName, false, true, false);
end;
end;
// optionally print HTML
if mUseDefaultPDF.checked = true
then pdfNameStart := 'c:\data\LogPg'
else pdfNameStart := 'c:\data\' +
getS(dData.TblTestHole,'TestHoleNum') + 'LogPg';
if (mOAskHTML.checked and
OptionConfirm('Do you wish to store a HTML version of the reports
in C:\DATA?'))
then case grStartPg of
0 : begin
pdfName := pdfNameStart + '1.HTM';
exporttoHTML(pipTH5,pdfName, false, true, false);
end;
1 : begin
pdfName := pdfNameStart + '1.HTM';
exporttoHTML(pipTH10,pdfName, false, true, false);
if grEndPg > 1
then begin
pdfName := pdfNameStart + '2.HTM';
exporttoHTML(pipTH20,pdfName, false, true, false);
if grEndPg > 2
then begin
pdfName := pdfNameStart + '3.HTM';
exporttoHTML(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.HTM';
exporttoHTML(pipTH40,pdfName, false, true,
false);
end;
end;
end;
end;
2 : begin
pdfName := pdfNameStart + '2.HTM';
exporttoHTML(pipTH20,pdfName, false, true, false);
if grEndPg > 2
then begin
pdfName := pdfNameStart + '3.HTM';
exporttoHTML(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.HTM';
exporttoHTML(pipTH40,pdfName, false, true, false);
end;
end;
end;
3 : begin
pdfName := pdfNameStart + '3.HTM';
exporttoHTML(pipTH30,pdfName, false, true, false);
if grEndPg > 3
then begin
pdfName := pdfNameStart + '4.HTM';
exporttoHTML(pipTH40,pdfName, false, true, false);
end;
end;
4 : begin
pdfName := pdfNameStart + '4.HTM';
exporttoHTML(pipTH40,pdfName, false, true, false);
end;
end;
// CleanUp
FreeGRsampleObjects(grSampleObject);
FreeGRsoilObjects(grSoilObject);
end;
procedure TFrmMain.LoadTheBitmaps;
const
bm = 'bitmaps\BIG'; // The bitmap directory
begin
// set up the custom brush bitmaps
bsBlank := tBitMap.create;
bsUnknown := tBitMap.create;
bsAsh := tBitMap.create;
bsAsphalt := tBitMap.create;
bsBrick := tBitMap.create;
bsClay := tBitMap.create;
bsClayeyGravel := tBitMap.create;
bsClayeySand := tBitMap.create;
bsClayeySilt := tBitMap.create;
bsCobbles := tBitMap.create;
bsConcrete := tBitMap.create;
bsFill := tBitMap.create;
bsGranite := tBitMap.create;
bsGravel := tBitMap.create;
bsGravelyClay := tBitMap.create;
bsGravelySand := tBitMap.create;
bsGravelySilt := tBitMap.create;
bsLimestone := tBitMap.create;
bsPeat := tBitMap.create;
bsSand := tBitMap.create;
bsSandAndGravel := tBitMap.create;
bsSandstone := tBitMap.create;
bsSandyClay := tBitMap.create;
bsSandyGravel := tBitMap.create;
bsSandySilt := tBitMap.create;
bsShale := tBitMap.create;
bsSilt := tBitMap.create;
bsSiltstone := tBitMap.create;
bsSiltyClay := tBitMap.create;
bsSiltyGravel := tBitMap.create;
bsSiltySand := tBitMap.create;
bsTopSoil := tBitMap.create;
bsSealBentonite := tBitMap.create;
bsSealCement := tBitMap.create;
bsSealConcrete := tBitMap.create;
bsSealGrout := tBitMap.create;
bsBlank.loadFromFile(bm+'Blank.bmp');
bsUnknown.loadFromFile(bm+'unknown.bmp');
bsAsh.loadFromFile(bm+'Ash.bmp');
bsAsphalt.loadFromFile(bm+'Asphalt.bmp');
bsBrick.loadFromFile(bm+'Brick.bmp');
bsClay.loadFromFile(bm+'Clay.bmp');
bsClayeyGravel.loadFromFile(bm+'ClayeyGravel.bmp');
bsClayeySand.loadFromFile(bm+'ClayeySand.bmp');
bsClayeySilt.loadFromFile(bm+'ClayeySilt.bmp');
bsCobbles.loadFromFile(bm+'Cobbles.bmp');
bsConcrete.loadFromFile(bm+'Concrete.bmp');
bsFill.loadFromFile(bm+'Fill.bmp');
bsGranite.loadFromFile(bm+'Granite.bmp');
bsGravel.loadFromFile(bm+'Gravel.bmp');
bsGravelyClay.loadFromFile(bm+'GravelyClay.bmp');
bsGravelySand.loadFromFile(bm+'GravelySand.bmp');
bsGravelySilt.loadFromFile(bm+'GravelySilt.bmp');
bsLimestone.loadFromFile(bm+'Limestone.bmp');
bsPeat.loadFromFile(bm+'Peat.bmp');
bsSand.loadFromFile(bm+'Sand.bmp');
bsSandAndGravel.loadFromFile(bm+'SandAndGravel.bmp');
bsSandstone.loadFromFile(bm+'Sandstone.bmp');
bsSandyClay.loadFromFile(bm+'SandyClay.bmp');
bsSandyGravel.loadFromFile(bm+'SandyGravel.bmp');
bsSandySilt.loadFromFile(bm+'SandySilt.bmp');
bsShale.loadFromFile(bm+'Shale.bmp');
bsSilt.loadFromFile(bm+'Silt.bmp');
bsSiltstone.loadFromFile(bm+'Siltstone.bmp');
bsSiltyClay.loadFromFile(bm+'SiltyClay.bmp');
bsSiltyGravel.loadFromFile(bm+'SiltyGravel.bmp');
bsSiltySand.loadFromFile(bm+'SiltySand.bmp');
bsTopSoil.loadFromFile(bm+'TopSoil.bmp');
bsSealBentonite.loadFromFile(bm+'SealBentonite.bmp');
bsSealCement.loadFromFile(bm+'SealCement.bmp');
bsSealConcrete.loadFromFile(bm+'SealConcrete.bmp');
bsSealGrout.loadFromFile(bm+'SealGrout.bmp');
end;
Forgot to mention, because it might actually BE the actual answer to
your question ....
These Big bitmaps were basically 11 inch high graphics. Didn't stretch
OR auto-size, just chopped off the button and right side as needed.
Sure gooses the size of the executable, but it solved THAT issue
completely for me.
GM
There was no attachment - but that is good because attachments should never
posted to the newsgroups. You can send attachments to support@
Data..
One option would be to create a set of bitmaps (or jpegs) that represent
each of the soil patterns. For each bitmap use the max height and width that
you will ever need. Store the bitmaps in files with relevant file names (or
store them in a separate database table). Then create some data that
describes the soil boring log. In the data refer to the bitmap file name (or
refer to the pattern id if storing bitmaps in a database). So at this point
we have some log data and some bitmaps.
Layout..
For the report layout use a DBImage to display the soil patterns. The
DBImage can be connected to the field that contains the bitmap filenames.
DBImage will automatically load and display the bitmap. Implement the
DetailBand.BeforePrint event to resize the height of the DBImage base on the
log data. The DBImage will only show the part of the bitmap that falls
within its bounds. (If you store the bitmap patterns in a database, then
just do a SQL join and connect the DBImage to the blob field).
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks for your help...I sort of thought of the same idea of using large
versions of the soil types. I'll give it a go.
Thanks for the help. I sort of thought of the same approach, but wasn't
sure if it was the way to go. Sorry about the attachment.