Home > Back-end > Questions about Delphi Excel operation
Questions about Delphi Excel operation
Time:09-20
Is to give 2 table, table 1 and table 2, and table is generated by Delphi three statements (excel), how many how many financial statement data are generated, (X is given by the data, Y is to automatically generate data) I will only do add and delete access database, Excel will not, there is a great god can you tell me how to do it, or any similar case? Thank you,
Table 1: The customer name shipping address contact... XX XX XXX company
Table 2: The customer name on June 7 August amounts owed arrears amount amounts owed XXX XXX XXX XXX company
Table 3: Hello Mr YY: You balance of YYY yuan
Shipping address: YYY Contact: YYY
CodePudding user response:
Delphi operation Excel simple example, you can also use Delphi's own controls, in the Servers page, on the same principle:
USES Comobj; procedure TForm1.Button1Click(Sender: TObject); Var ExlApp WorkBook1, Sheet1: Variant; J: integer; The begin Try ExlApp:=CreateOleObject (' Excel. Application); WorkBook1:=CreateOleObject ('. Excel Sheet); Except, MessageBox (handle, 'call wrong, there is no right to install Microsoft Excel! ', 'prompt', MB_OK + MB_ICONInformation); The Exit; end; ExlApp. Visible:=True; WorkBook1:=exlApp WorkBooks. Add;//add the workspace Sheet1:=WorkBook1 WorkSheets [1].//get the first book For j:=1 to 5 do The begin Sheet1. Columns [j]. Journal of numberformatlocal:='@';//set as text format Sheet1. Cells [1, j] Interior. Color:=$00 d9ffce;//set the cell background to light green Sheet1. Cells [1, j] Borders. [9] graphics.linestyle:=1;//set the border lines Sheet1. Columns [j]. Journal of columnwidth:=20;//set the column width Sheet1. Cells [j] 1, :='cell value; end; end;