Word Plug-in v4 and charts

Questions and answers on developing, deploying and using plugins and JavaBeans

Word Plug-in v4 and charts

Postby IT2Be » Fri Jun 30, 2017 7:52 am

Hi all,

I wanted to let you know that I have added the use of charts to the Word Plug-in v4.

The way to use it is shown in the API Specifications of the IWDocument Object under 'createChart(...)'.

Please check it out and let me know what you think or, if you need more/other functionality, create a ticket here.

This is a piece of example code:
Code: Select all
/** @type {plugins.it2be_word.IWDocument} */
var vDocument;
/** @type {plugins.it2be_word.IWChart} */
var vChart;
/** @type {plugins.it2be_word.IWChartSeries} */
var vChartSeries;
/** @type {Array<String>} */
var vCategories;

// Create the Word document
vDocument = plugins.it2be_word.createDocument( );

// Create the chart
vChart = vDocument.createChart( plugins.it2be_word.CHART_TYPE.LINE, 432, 252 );

// Create an array with ALL the categories you want to set
vCategories = [ "AW Category 1", "AW Category 2" ];

// Adding new series.
// Arrays must not be empty and arrays must be the same size.
vChart.addCategories( "AW Series 1", vCategories, [ 1, 2 ] );
vChart.addCategories( "AW Series 2", vCategories, [ 3, 4 ] );
vChart.addCategories( "AW Series 3", vCategories, [ 5, 6 ] );
vChartSeries = vChart.addCategories( "AW Series 4", vCategories, [ 7, 8 ] );

vChartSeries.smooth = true;

// Move to the start of the document
vDocument.gotoStart( );

// Insert the chart now
vDocument.insertChart( vChart );

// Define where and under what name you want the save the new file
// the path name should ALWAYS be the complete absolute path
// by adding the extension or the document type you also set the format (default is .docx)
// available formats/extensions are .doc, .docx, .txt and .html
vDocument.save( plugins.file.getDesktopFolder( ) + "/it2be-word.docx" );
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: Word Plug-in v4 and charts

Postby Peter de Groot » Fri Jun 30, 2017 8:51 am

nice.gif
nice.gif (1.43 KiB) Viewed 2660 times


Regards Peter
User avatar
Peter de Groot
 
Posts: 215
Joined: Thu Jan 10, 2008 8:38 pm
Location: Not sure...


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 10 guests