VFP控制EXECL制圖 PROCEDURE prdConfirmPrintA m.xlsExcel=CREATEOBJECT('Excel.Application') WITH xlsExcel .WorkBooks.Add DO prdPrintGeneralStatistic WITH UPPER(fncTran('Statistic of progress')) IN _Splr DO prdPieChart WITH 'A1:'+CHR(64+m.nFld)+LTRIM(STR(RECCOUNT()-1)),'',m.cChartTitle DO prdColumnWithDepthChart WITH 'A1:'+CHR(64+m.nFld)+LTRIM(STR(RECCOUNT()-1)),fncTran('1'),3,m.cChartTitle DO prdColumnWithDepthChart WITH 'A1:'+CHR(64+m.nFld)+LTRIM(STR(RECCOUNT()-1)),fncTran('2'),0,m.cChartTitle .Sheets(fncTran('Data')).Select .Visible=.T. ENDWITH ENDPROC
柱圖代碼
PROCEDURE prdColumnWithDepthChart PARAMETERS m.cRange,m.cChartName,m.nBarShape,m.cChartTitle .Sheets('Sheet2').Select .Sheets('Sheet2').Range(m.cRange).Select .Charts.Add WITH .ActiveChart .Name =fncTran('Column chart')+m.cChartName .ChartType =54 .Elevation =20 .Rotation =25 .GapDepth =0 .BarShape =m.nBarShape .DepthPercent =500 .HeightPercent =100 .HasTitle =.T. .HasLegend =.F. .HasDataTable =.F. .RightAngleAxes =.T. .WallsAndGridLines2D =.T. .ChartGroups(1).VaryByCategories=.T. .Walls.ClearFormats WITH .ChartTitle.Characters WITH .Font .Size =18 .Bold =.T. .Name ='Arial' ENDWITH .Text =m.cChartTitle ENDWITH WITH .Axes(1).TickLabels .Orientation =30 .Font.Size =12 .Font.Name ='Arial' ENDWITH WITH .Axes(2) .MajorGridLines.Delete .TickLabels.Font.Size =12 .TickLabels.Font.Name ='Arial' ENDWITH WITH .SeriesCollection(1) .ApplyDataLabels WITH .DataLabels .Orientation =30 .Font.Size =12 .Font.Name ='Arial' ENDWITH ENDWITH .PageSetup.CenterHeader =m.cTitleText ENDWITH ENDPROC
餅圖代碼
PROCEDURE prdPieChart PARAMETERS m.cRange,m.cChartName,m.cChartTitle .Sheets('Sheet2').Select .Sheets('Sheet2').Range(m.cRange).Select .Charts.Add WITH .ActiveChart .Name =fncTran('Pie chart')+m.cChartName .ChartType =70 .HasTitle =.T. .HasLegend =.F. .ApplyDataLabels WITH .SeriesCollection(1).DataLabels .Type =5 .Font.Size =12 .Font.Name ='Arial' .NumberFormatLocal ='0.00%' ENDWITH WITH .PlotArea .Border.LineStyle =0 .Interior.ColorIndex=2 ENDWITH WITH .ChartTitle.Characters WITH .Font .Size =18 .Bold =.T. .Name ='Arial' ENDWITH .Text =m.cChartTitle ENDWITH .PageSetup.CenterHeader =m.cTitleText ENDWITH ENDPROC
折線圖代碼
PROCEDURE prdLineChart PARAMETERS m.cRange,m.cChartName,m.cChartTitle .Sheets('Sheet2').Select .Sheets('Sheet2').Range(m.cRange).Select .Charts.Add WITH .ActiveChart .Name =fncTran('Line chart')+m.cChartName .ChartType =65 .HasTitle =.T. .HasLegend =.F. .ApplyDataLabels WITH .Axes(1) .HasMajorGridLines =.F. .HasMinorGridLines =.F. WITH .TickLabels .Orientation =30 .Font.Size =12 .Font.Name ='Arial' ENDWITH ENDWITH WITH .Axes(2) .HasMajorGridLines =.F. .HasMinorGridLines =.F. .TickLabels.Font.Size =12 .TickLabels.Font.Name ='Arial' ENDWITH WITH .SeriesCollection(1) WITH .Border .ColorIndex =3 .Weight =3 ENDWITH WITH .DataLabels .Border.LineStyle =-4105 .Position =0 .Font.Size =12 .Font.Name ='Arial' .Interior.ColorIndex =28 .Shadow =.T. ENDWITH .Shadow =.T. .Smooth =.T. ENDWITH WITH .PlotArea .Border.LineStyle =0 .Interior.ColorIndex =2 ENDWITH WITH .ChartTitle.Characters .Text =UPPER(m.cChartTitle) WITH .Font .Size =18 .Bold =.T. .Name ='Arial' ENDWITH ENDWITH .PageSetup.CenterHeader =m.cTitleText ENDWITH ENDPROC
FUNCTION fncTran(m.cLanguage) IF SEEK(ALLTRIM(m.cLanguage),'Lngs','cEnglish') AND !EMPTY(Lngs.cCurrent) =SEEK(ALLTRIM(m.cLanguage),'Lngs','cEnglish') RETURN ALLTRIM(Lngs.cCurrent) ELSE RETURN ALLTRIM(m.cLanguage) ENDIF ENDFUNC
凡是出現(xiàn)fncTran()的地方你可以用其他文本替代,fncTran是自編語言翻譯函數(shù)
|