Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSGraph Charting ----) Printing ....
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00458290
Message ID:
00458307
Views:
18
>HAPPY NEW YEAR TO ALL OF YOU.
>
>I have created a chart in my form fulfilling all the properties, but Now I want to print that chart.
>
>1. Seeking for the option directly to print from my form. (first preference)
> OR
>2. Copying the Chart and open into any document automation software like MSWord,MSExcel but should be auto and no user control should be invovled.
>
>Any other suggestion apart from this are also welcome.
>
>Regards,
>Rajesh


Hi Rajesh,

This is how I am currently using Word to print charts, although I too would prefer to print directly from the form.


Code for the 'Print' button on the chart form (assuming the chart is already created and displayed):

*- Place the chart on the clipboard
THIS.PARENT.oChart.Editcopy

*- Create an instance of Word
oWord=CREATE('Word.Application')

*- Open a previously created blank document
oWord.Documents.OPEN('MYDOC.DOC')

*- Run a macro stored in that document
oWord.APPLICATION.RUN('PASTECHART')

*- Print the chart and close Word
oWord.ActiveDocument.PrintOut(0)
oWord.ActiveDocument.CLOSE(0)
oWord.QUIT(0)
RELEASE oWord

I created a blank document (here I show it named as MYDOC.DOC) and added a new macro to it. The macro simply does a Paste Special. I really didn't want to have to use the macro, but the syntax for performing the Paste Special was giving me fits.

Anyway, the sample code above is what I use to allow the user to click a command button on the form and send the chart to the printer without having to take any other steps. Of course, you'll need to distribute the blank Word document (containing the macro) and the end user will need to have Word installed, but other than that, it's pretty simple and doesn't require any user intervention.

As a side note, anyone using Office 2000 AND Norton Anti-virus 2000 will run into some slight problems. You can check out the Microsoft Knowledge Base article Q246018 for details about automation problems while running those two programs.

HTH,
Previous
Reply
Map
View

Click here to load this message in the networking platform