Examples of reports that use Cxspreadsheetbook spreadsheet controls to complete complexity

Source: Internet
Author: User

If the report is complex, you can use the Cxspreadsheetbook spreadsheet control to generate the report.

The following example is to load the data at the same time to set the spreadsheet format:

Procedure Tao_repshowdata.loadrepdata;
Var
Curcursor:tcursor;
Begin
Curcursor: = Screen.cursor; Cursor settings
Screen.cursor: = Crhourglass;
Try
Cxspreadbook.beginupdate;
Loadtitle; Load a table header from a database fetch number
LoadData; Loading tabular data from a database fetch
CxSpreadBook.ActiveSheet.SelectCell ( -1,-1, False);//cursor position in table extra
Finally
Cxspreadbook.endupdate;
Cxspreadbook.recalc; Recalculate tables
Cxspreadbook.activepage: = 0; First page

Screen.cursor: = Curcursor; Cursor settings

End
End

Procedure Tao_repshowdata.loadtitle; Load table Header
Var
I, Crow:integer;
Cheader:tcxssheader;
Begin
I: = Cdsanalysefield.recordcount; Number of merged cells

globalvars.values[' RepName ' is a variable
Setcelltext (1, 0, globalvars.values[' repname '); Set table header name (report name) CxSpreadBook.ActiveSheet.Caption: = globalvars.values[' repname '];//page label name
CxSpreadBook.ActiveSheet.SelectCell (1, 0); Select cells
Setmergedstatea (1, 0, i + 1, 0, true); Merge cells
Setcellfont (1, 0, I, 0, [Fsbold], 20); Set Font size
Setcellsstyle ([Svalign], Hacenter, 0, Cbxfont.text, []);
Setcellalignment (1, 0, i + 1, 0, Hacenter, vacenter);//Format Center
Setcelltext (1, 1, globalvars.values[' JHDW '); Set up amount units
Setcelltext (1, 2, ' unit name ');//Set table title
Setcellalignment (1, 2, 1, 2, Hacenter, vacenter);//Format Center

Setcellfont (1, 2, 1, 2, [Fsbold], 8);
Cheader: = CxSpreadBook.ActiveSheet.Cols;
CHEADER.SIZE[1]: = 180;//column width
Cdsrepdwdata.disablecontrols;
Try
CRow: = 3;//starting from the third line
Cxspreadbook.activepage: = 0;
Cdsrepdwdata.first;
While not cdsrepdwdata.eof do begin
Setcelltext (1, CRow, Cdsrepdwdatadanwei_mingchang. Value);//fill in the table cell with the number from the database
Cdsrepdwdata.next;
INC (CRow);
End
Setmnucellborders (1, 2, 1, CRow-1, 5);//Set Table format
Setcellpattern (1,2,1,currow-1,23,1,fssolid);
Finally
Cdsrepdwdata.enablecontrols; Restore Original cursor
End
End

Procedure tao_repshowdata.loaddata;//Loading Data
Var
Curcol, Currow:integer;
Cheader:tcxssheader;
Begin
If Cdsanalysefield.recordcount > 0 Then
Begin
Try

Cxspreadbook.activepage: = 0;
Cdsanalysefield.disablecontrols;
Curcol: = 2;//starting from the second column
Currow: = 3;//starting from the third line
Cdsanalysefield.first;
While not cdsanalysefield.eof do begin
Cheader: = CxSpreadBook.ActiveSheet.Cols;
Cheader.size[curcol]: = 120;//column width
Setcelltext (Curcol, 2, Cdsanalysefieldanalyse_field_name. Value);
Try
Openrepdwdata (globalvars.values[' DANWEI_QYDM '), Strtoint (globalvars.values[' Rep_vol_key ']), cdsAnalyseFieldSIGN_ Cell_key. Value);
Cdsrepdwdata.disablecontrols;
Currow: = 3;
Cdsrepdwdata.first;
While not cdsrepdwdata.eof do begin
If CxSpreadBook.ActiveSheet.GetCellObject (1, Currow). Text = Cdsrepdwdatadanwei_mingchang. Value Then
Begin
If Cdsrepdwdatasign_dell_type. Value = 0 Then//roundfloat (strtofloat (Text), 2)
If Cdsrepdwdatarep_data. Value = 0 Then
Setcelltext (Curcol, Currow, ' 0 ')
Else
Begin
If globalvars.values[' jhdw ' = ' Amount unit: Meta ' then//load data, amount converted into yuan.
Setcelltext (Curcol, Currow, Formatfloat (' #,#.00 ', Cdsrepdwdatarep_data.    Value)); Formatfloat (' #,#.## ', Cdsrepcelldatarep_data. Value))
If globalvars.values[' jhdw ' = ' Amount unit: Million ' then//load data, amount conversion millions yuan.
Setcelltext (Curcol, Currow, Formatfloat (' #,#.00 ', Strtofloat (Floattostr (cdsrepdwdatarep_data). value/10000)));
If globalvars.values[' jhdw ' = ' Amount unit: billion yuan ' then//load data, the amount converted into billion yuan.
Setcelltext (Curcol, Currow, Formatfloat (' #,#.00 ', Strtofloat (Floattostr (cdsrepdwdatarep_data). value/100000000)));
End
If Cdsrepdwdatasign_dell_type. Value = 1 Then
Setcelltext (Curcol, Currow, Cdsrepdwdatarep_text. Value);
End
Cdsrepdwdata.next;
INC (Currow);
End
Finally
Cdsrepdwdata.enablecontrols; Restore Original cursor
End
Cdsanalysefield.next;
INC (Curcol);
End
Setcellformat (2, 3, Curcol, Currow, 4);//Set Table format
Setmnucellborders (2, 2, CurCol-1, CurRow-1, 5);//Set Table lines
Setcellalignment (2, 2, Curcol, 2, Hacenter, vacenter);
Setcellfont (2, 2, Curcol, 2, [Fsbold], 8);
Finally
Cdsanalysefield.enablecontrols; Restore Original cursor
End
End
End

Examples of reports that use Cxspreadsheetbook spreadsheet controls to complete complexity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.