F1BOOK

xiaoxiao2021-03-06  38

TO XXXYYUUUUUUUUu (I don't understand)): I use the F1Book, C Builder version number with itself in C Builder, 5.0 (Build 12.34), click F1Book Help display Formula One 3.0 (except this I don't know how to see my version number) I have passed the source code of my program. If you have no problem, it is estimated that you can tell me where to get high versions of Formula One.

The purpose of the program is to display the contents of the general DBGRID to F1Book, so that the data is exported. Enter data (unless it is a bulk input) I still use DBGRID, but DBGRID does not easily implement block replication, print, export function.

First create a form, drag on the three controls on DBGRID, just connect the previous database, I use SQL Server, after the display is successful, put F1Book1 on the screen, plus a button, click the button. The corresponding code is as follows: (function is to display the content of the DBGRID to F1Book1, the writing of the code is versatile)

Ansistring TMPFD, TMPNAME; INT I, J, TOTALNUM, TOTALCOL, KK;

Totalnum = dbgrid1-> datasource-> dataset-> recordcount; // Total number of records

KK = 0; for (i = 0; i columns-> count; i ) {if (dbgrid1-> columns-> items [i] -> visible) kk = kk 1;} Totalcol = kk; // Table number if (Totalnum> 16384) {Application-> MessageBox ("The result is too big, can not exceed 16384 lines!", "Tips", 48);} if (TotalNum == 0) {f1book1-> Maxcol = 1; f1book1-> maxRow = 1; return;} f (totalcol> 0) f1book1-> maxCol = Totalcol; if (Totalnum> 0) f1book1-> maxrow = TotalNum;

F1Book1-> ClearRange (1, 1, f1book1-> maxrow, f1book1-> maxcol, 1);

For (i = 1; i <= Totalcol; i ) {f1book1-> coltext [i] = char (i 64);

// Output title KK = 0; for (i = 0; i columns-> count; i ) {if (dbgrid1-> columns-> items [i] -> visible) {kk = kk 1; TColumn * Column = DBGrid1-> Columns-> Items [i]; TColumnTitle * ColumnTitle = column-> Title; AnsiString tmpname = ColumnTitle-> Caption; F1Book1-> ColText [kk] = tmpname;}} // following output TDataSet * THEDS = DBGRID1-> Datasource-> DataSet; these; ads-> first (); for (j = 0; j Column-> count; i ) {if (dbgrid1-> columns-> items [i] -> visible) {kk = kk 1; tmpfd = dbgrid1-> columns-> items [i] -> fieldname; IF (THEDS-> FieldByname (TMPFD) -> Datatype == ftinteger) f1book1-> textrc [j 1] [KK] = INTOSTR (THEDS-> FieldByname (TMPFD) -> Asinteger; Else F1Book1-> Textrc [J 1] [KK] = THEDS-> FIELDBYNAME (TMPFD) -> asstring;}} THEDs-> next ();} these Ablecontrols (); theds-> first ();

// Setting effect screen-> cursor = crdefault; f1book1-> colorden [1] = false; f1book1-> rowhidden [1] = false; f1book1-> setfont ('Song Body', 9, False, False, False, False, RGB (0,0,0), false, false; f1book1-> setColwidthauto (1, 1, f1book1-> maxrow, f1book1-> maxcol, true); // maximum width is not more than 6000 for (i = 0; i maxcol; i ) // file: // write field name to the first line of the work thin {IF (f1book1-> COLWIDTH [i 1]> 6000 || F1Book1-> COLWIDTH [i 1] <0) F1Book1-> COLWIDTH [i 1] = 6000;} f1book1-> hdrheight = 400; f1book1-> setrow, 300, true); press this code, with normal travel line, I will report an error later. The display content is Project Project1 raised exception class eolesyserror with message 'unknown interface'. Peocess stop. Use step or run to payue

转载请注明原文地址:https://www.9cbs.com/read-71147.html

New Post(0)