Home > Back-end >  Delphi use Tchart drawing histogram how export to Excel? Don't save pictures in copy to excel
Delphi use Tchart drawing histogram how export to Excel? Don't save pictures in copy to excel

Time:09-20

If inscribe


Like this bar chart

CodePudding user response:

If you don't save pictures, that it's not transfer problem of histogram, but how to extract data from the bar chart or direct use it the source of the data, call the Excel interface to create Excel their histograms, one is the data source, the other is called Excel interface, can be CreateOleObject (' Excel. Application), and see if I can call Excel histogram function, help to check the Excel interface,

CodePudding user response:

reference 1st floor santiaodahan response:
if you don't save pictures, that it's not transfer problem of histogram, but how to extract data from the bar chart or direct use it the source of the data, call the Excel interface to create Excel their histograms, one is the data source, the other is called Excel interface, can be CreateOleObject (' Excel. Application), and see if I can call Excel histogram function, help to check the Excel interface,

Is there any similar document demo?
Send a under reference

CodePudding user response:

There is no need for such a complex, directly in the generated EXCEL, create Chart Chart in the EXCEL,

CodePudding user response:

Can search on the net,
For example: http://blog.csdn.net/zang141588761/article/details/51700694

CodePudding user response:

reference lyhoo163 reply: 3/f
there is no need for such a complex, directly in the generated EXCEL, create Chart Chart in the EXCEL,

To code, look at you directly generate Excel and Chart, and I said there is difference,

CodePudding user response:

reference 4 floor ZBDZJX response:
can search on the net,
For example: http://blog.csdn.net/zang141588761/article/details/51700694

ChartObject is Excel object of an embedded chart,

CodePudding user response:

refer to 6th floor santiaodahan response:
Quote: refer to 4th floor ZBDZJX response:

Can search on the net,
For example: http://blog.csdn.net/zang141588761/article/details/51700694

ChartObject is Excel object of an embedded chart,

Is there a code under reference

CodePudding user response:

refer to 7th floor kaixing1218 response:
Quote: refer to the sixth floor santiaodahan response:

Quote: refer to 4th floor ZBDZJX response:

Can search on the net,
For example: http://blog.csdn.net/zang141588761/article/details/51700694

ChartObject is Excel object of an embedded chart,

Is there a code under reference?

Going out for a while, wait a moment.

CodePudding user response:

Excel generating charts, can also use the Servers page wrapper component, more convenient, on the same principle,
 
USES ComObj;
Var
ExlApp WorkBook1, Sheet1, Chart1 Range1, Series1: Variant;

Procedure TForm1. Button1Click (Sender: TObject);
Var
I: integer;
The begin
Try
ExlApp:=CreateOleObject (' Excel. Application);
WorkBook1:=CreateOleObject ('. Excel Sheet);
Chart1:=CreateOleObject (' Excel. Chart);
Except,
MessageBox (Handle, 'call Excel fail,' 'warning', MB_OK + MB_ICONWarning);
The Exit;
end;
ExlApp. Visible:=False;
WorkBook1:=exlApp WorkBooks. Add;
ExlApp. Workbooks [1]. The Worksheets [1]. The Name:='Data1';
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sheet1:=exlApp Workbooks [1]. The Worksheets [' Data1];
For I:=1 to 10 do
Sheet1. Cells: [I, 1]=I;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Chart1:=exlApp Charts. The Add;
Chart1. ChartType:=$FFFFEFFC;//chart type xl3DColumn
Range1:=exlApp. Sheets. Item [' Data1] Range [' A5: A10];
Series1:=Chart1. SeriesCollection;
Series1. Add (Range1, True);
ExlApp. Visible:=True;
end;

Procedure TForm1. FormDestroy (Sender: TObject);
The begin
If not VarIsEmpty (exlApp) then
The begin
ExlApp. DisplayAlerts:=False;//exit without saving
ExlApp. Quit;
end;
end;

CodePudding user response:

references 9 f santiaodahan response:
Excel generating charts, can also use the Servers page wrapper component, more convenient, on the same principle,
 
USES ComObj;
Var
ExlApp WorkBook1, Sheet1, Chart1 Range1, Series1: Variant;

Procedure TForm1. Button1Click (Sender: TObject);
Var
I: integer;
The begin
Try
ExlApp:=CreateOleObject (' Excel. Application);
WorkBook1:=CreateOleObject ('. Excel Sheet);
Chart1:=CreateOleObject (' Excel. Chart);
Except,
MessageBox (Handle, 'call Excel fail,' 'warning', MB_OK + MB_ICONWarning);
The Exit;
end;
ExlApp. Visible:=False;
WorkBook1:=exlApp WorkBooks. Add;
ExlApp. Workbooks [1]. The Worksheets [1]. The Name:='Data1';
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sheet1:=exlApp Workbooks [1]. The Worksheets [' Data1];
For I:=1 to 10 do
Sheet1. Cells: [I, 1]=I;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Chart1:=exlApp Charts. The Add;
Chart1. ChartType:=$FFFFEFFC;//chart type xl3DColumn
Range1:=exlApp. Sheets. Item [' Data1] Range [' A5: A10];
Series1:=Chart1. SeriesCollection;
Series1. Add (Range1, True);
ExlApp. Visible:=True;
end;

Procedure TForm1. FormDestroy (Sender: TObject);
The begin
If not VarIsEmpty (exlApp) then
The begin
ExlApp. DisplayAlerts:=False;//exit without saving
ExlApp. Quit;
end;
end;

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related