Page 1 of 1

Word Plug-in v4 and charts

PostPosted: Fri Jun 30, 2017 7:52 am
by IT2Be
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" );

Re: Word Plug-in v4 and charts

PostPosted: Fri Jun 30, 2017 8:51 am
by Peter de Groot
nice.gif
nice.gif (1.43 KiB) Viewed 2714 times


Regards Peter