Hi all!
I am taking a proposition of Mike Lewis and opening new thread that (i hope) would put some light on work with MS Chart control.
I took Mikes class as a start. You can find free download on his web-site.
But as we all know ¡V there is always place for improvement
I added couple of new properties and methods.
Some of them :
ChartToWord()
LOCAL loWord,lcDoc
loWord=CREATEOBJECT("Word.Application"
lcDoc=THISFORM.cntSelectFile.txtFile.VALUE && users entry
loWord.DisplayAlerts = .F.
loWord.Documents.Open(lcDoc)
THISFORM.PrintChart.EditCopy() && copy chart to clipboard
loWord.Selection.PasteSpecial(.F., .F., 0, .F., 3)
loWord.Documents.Save(.T.) && save
loWord.Documents.Close(0)
loWord.quit()
loWord =.NULL.
RELEASE loWord
ChartToExcel()
*-- work in progress ( difficulties with syntax)
LOCAL loExcel,loExcelDoc,loExcelSheet
loExcel=CREATEOBJECT("Excel.Application"
&& Select sheet
loExcelDoc=loExcel.Application.WorkBooks.Add() && new excel sheet
loExcelSheet=loExcel.Application.Worksheets("Sheet1"
.Activate && Select sheet
THISFORM.PrintChart.EditCopy() && copy chart to clipboard
loExcelDoc.Selection.PasteSpecial(.F., .F., 0, .F., 3) &&?????
loExcelDoc.PrintOut
loExcelDoc.Close(0)
*-- Mike ? Would you help , please ? ļ
SetChartParameters()
*-- Titles for axis
*-- x
IF !EMPTY(THIS.cXAxisTitle)
WITH THIS.PrintChart.Plot.Axis(0)
.AxisTitle.Text = ALLT(THIS.cXAxisTitle)
.AxisTitle.vtFont.Name = "Tahoma"
.AxisTitle.VtFont.Effect = 512
.AxisTitle.VtFont.Size = 12
.AxisTitle.VtFont.Style = 1
ENDWITH
ENDIF
*-- y
IF !EMPTY(THIS.cYAxisTitle)
WITH THIS.PrintChart.Plot.Axis(1)
.AxisTitle.Text = THIS.cYAxisTitle
.AxisTitle.vtFont.Name = "Tahoma"
.AxisTitle.VtFont.Effect = 512
.AxisTitle.VtFont.Size = 14
.AxisTitle.VtFont.Style = 1
ENDWITH
ENDIF
*-- Grid divisions
WITH THIS.PrintChart.Plot.Axis(1).ValueScale
IF THIS.nMajor<>0 OR THIS.nMinor<>0
.Auto = .F.
ENDIF
IF THIS.nMajor<>0
.MajorDivision = THIS.nMajor
ENDIF
IF THIS.nMinor<>0
.MinorDivision = THIS.nMinor
ENDIF
ENDWITH
*-- Pen
WITH THIS.PrintChart.Plot.Axis(1).AxisGrid
.MajorPen.Width = IIF(THIS.nMajorPen<>0, THIS.nMajorPen ,2) && does¡¦t work !
.MinorPen.Width = IIF(THIS.nMinorPen<>0, THIS.nMinorPen ,1)
ENDWITH
If you have anything to add -- please do ... on my side ..each time time something will start to work -- i'll post it here.
thanks to everybody for participation
I am taking a proposition of Mike Lewis and opening new thread that (i hope) would put some light on work with MS Chart control.
I took Mikes class as a start. You can find free download on his web-site.
But as we all know ¡V there is always place for improvement
I added couple of new properties and methods.
Some of them :
ChartToWord()
LOCAL loWord,lcDoc
loWord=CREATEOBJECT("Word.Application"
lcDoc=THISFORM.cntSelectFile.txtFile.VALUE && users entry
loWord.DisplayAlerts = .F.
loWord.Documents.Open(lcDoc)
THISFORM.PrintChart.EditCopy() && copy chart to clipboard
loWord.Selection.PasteSpecial(.F., .F., 0, .F., 3)
loWord.Documents.Save(.T.) && save
loWord.Documents.Close(0)
loWord.quit()
loWord =.NULL.
RELEASE loWord
ChartToExcel()
*-- work in progress ( difficulties with syntax)
LOCAL loExcel,loExcelDoc,loExcelSheet
loExcel=CREATEOBJECT("Excel.Application"
&& Select sheet
loExcelDoc=loExcel.Application.WorkBooks.Add() && new excel sheet
loExcelSheet=loExcel.Application.Worksheets("Sheet1"
THISFORM.PrintChart.EditCopy() && copy chart to clipboard
loExcelDoc.Selection.PasteSpecial(.F., .F., 0, .F., 3) &&?????
loExcelDoc.PrintOut
loExcelDoc.Close(0)
*-- Mike ? Would you help , please ? ļ
SetChartParameters()
*-- Titles for axis
*-- x
IF !EMPTY(THIS.cXAxisTitle)
WITH THIS.PrintChart.Plot.Axis(0)
.AxisTitle.Text = ALLT(THIS.cXAxisTitle)
.AxisTitle.vtFont.Name = "Tahoma"
.AxisTitle.VtFont.Effect = 512
.AxisTitle.VtFont.Size = 12
.AxisTitle.VtFont.Style = 1
ENDWITH
ENDIF
*-- y
IF !EMPTY(THIS.cYAxisTitle)
WITH THIS.PrintChart.Plot.Axis(1)
.AxisTitle.Text = THIS.cYAxisTitle
.AxisTitle.vtFont.Name = "Tahoma"
.AxisTitle.VtFont.Effect = 512
.AxisTitle.VtFont.Size = 14
.AxisTitle.VtFont.Style = 1
ENDWITH
ENDIF
*-- Grid divisions
WITH THIS.PrintChart.Plot.Axis(1).ValueScale
IF THIS.nMajor<>0 OR THIS.nMinor<>0
.Auto = .F.
ENDIF
IF THIS.nMajor<>0
.MajorDivision = THIS.nMajor
ENDIF
IF THIS.nMinor<>0
.MinorDivision = THIS.nMinor
ENDIF
ENDWITH
*-- Pen
WITH THIS.PrintChart.Plot.Axis(1).AxisGrid
.MajorPen.Width = IIF(THIS.nMajorPen<>0, THIS.nMajorPen ,2) && does¡¦t work !
.MinorPen.Width = IIF(THIS.nMinorPen<>0, THIS.nMinorPen ,1)
ENDWITH
If you have anything to add -- please do ... on my side ..each time time something will start to work -- i'll post it here.
thanks to everybody for participation