procedure TDoExportForm.CreateSeries(sc: SeriesCollection; FlowStr, ValueStr:
String;
out minmax: TMinMax);
var
ser: Series;
i: Integer;
ws: _Worksheet;
cell1, cell2: OleVariant;
spalteFlow, spalteValue: Integer;
zeilen: Integer;
maxflow, minflow, maxvalue, minvalue, temp: Real;
pts: Points;
pt: Point;
o: integer;
rng: ExcelRange;
begin
minmax.maxFlow:= varNull;
minmax.maxValue:= varNull;
minmax.minFlow:= varNull;
minmax.minValue:= varNull;
for i:= 1
to Excel.Worksheets.Count
do begin
ws:= Excel.Worksheets[i]
as _Worksheet;
if IsDataWorksheet(ws)
then begin
spalteFlow:= FindeSpalte(ws, FlowStr);
spalteValue:= FindeSpalte(ws, ValueStr);
if (spalteFlow > 0)
and (spalteValue > 0)
then begin
zeilen:= Min(ZaehleZeilen(ws, SpalteFlow), ZaehleZeilen(ws, SpalteValue));
if Zeilen > 0
then begin
ser:= sc.NewSeries;
ser.
Name:= ws.
Name;
ser.AxisGroup:= xlPrimary;
cell1:= ws.Cells.Item[3, spalteFlow];
cell2:= ws.Cells.Item[zeilen +2, spalteFlow];
ser.XValues:= ExcelRangeToString(ws, cell1, cell2);
cell1:= ws.Cells.Item[3, spalteValue];
cell2:= ws.Cells.Item[zeilen +2, spalteValue];
ser.Values:= ExcelRangeToString(ws, cell1, cell2);
ser.Border.ColorIndex:= 1;
ser.Border.Weight:= xlThin;
pts:= ser.Points(EmptyParam)
as Points;
pt:= pts.Item(pts.Count);
// Hier kommt es zur Exception, ungültiger Paramter
pt.ApplyDataLabels(xlDataLabelsShowLabel, EmptyParam, EmptyParam, EmptyParam, true, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam);
pt.DataLabel.ShowValue:= False;
cell1:= ws.Cells.Item[1, 3];
pt.DataLabel.Caption:= ExcelRangeToString(ws, cell1, cell1);
pt.DataLabel.Interior.ColorIndex:= 2;
pt.DataLabel.Interior.PatternColorIndex:= 1;
pt.DataLabel.Font.Size:= 8;
pt.DataLabel.AutoScaleFont:= False;